Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1456227

Re: [PATCH] fs:Fix kmemleak leak warning in getname_flags about working on unitialized memory

From Alexnader Kuleshov <kuleshovmail@gmail.com>
Newsgroups linux.kernel
Subject Re: [PATCH] fs:Fix kmemleak leak warning in getname_flags about working on unitialized memory
Date 2016-08-04 11:10 +0200
Message-ID <s2mP7-6St-5@gated-at.bofh.it> (permalink)
References <s2mP7-6St-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On 08-03-16, Nicholas Krause wrote:
> This fixes a kmemleak leak warning complaining about working on
> unitializied memory as found in the function, getname_flages. Seems

s/getname_flages/getname_flags

> that we are indeed working on unitialized memory, as the filename
> char pointer is never made to point to the filname structure's result
> member for holding it's name, fix this by using memcpy to copy the
> filname structure pointer's, name to the char pointer passed to this
> function.
> 
> Signed-off-by: Nicholas Krause <xerofoify@gmail.com>
> ---
>  fs/namei.c         | 1 +
>  mm/early_ioremap.c | 1 +
>  2 files changed, 2 insertions(+)
> 
> diff --git a/fs/namei.c b/fs/namei.c
> index c386a32..6b18d57 100644
> --- a/fs/namei.c
> +++ b/fs/namei.c
> @@ -196,6 +196,7 @@ getname_flags(const char __user *filename, int flags, int *empty)
>  		}
>  	}
>  
> +	memcpy((char *)result->name, filename, len);
>  	result->uptr = filename;
>  	result->aname = NULL;
>  	audit_getname(result);
> diff --git a/mm/early_ioremap.c b/mm/early_ioremap.c
> index 6d5717b..92c5235 100644
> --- a/mm/early_ioremap.c
> +++ b/mm/early_ioremap.c
> @@ -215,6 +215,7 @@ early_ioremap(resource_size_t phys_addr, unsigned long size)
>  void __init *
>  early_memremap(resource_size_t phys_addr, unsigned long size)
>  {
> +	dump_stack();

Why?

>  	return (__force void *)__early_ioremap(phys_addr, size,
>  					       FIXMAP_PAGE_NORMAL);
>  }
> -- 
> 2.7.4
> 

Back to linux.kernel | Previous | Next | Find similar | Unroll thread


Thread

Re: [PATCH] fs:Fix kmemleak leak warning in getname_flags about  working on unitialized memory Alexnader Kuleshov <kuleshovmail@gmail.com> - 2016-08-04 11:10 +0200

csiph-web