All of lore.kernel.org
 help / color / mirror / Atom feed
* [patch] nfs: testing the wrong variable
@ 2010-10-28  6:05 ` Dan Carpenter
  0 siblings, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2010-10-28  6:05 UTC (permalink / raw)
  To: Trond Myklebust; +Cc: linux-nfs, kernel-janitors

The intent was to test "*desc" for allocation failures, but it tests
"desc" which is always a valid pointer here.

Signed-off-by: Dan Carpenter <error27@gmail.com>

diff --git a/fs/nfs/idmap.c b/fs/nfs/idmap.c
index dec47ed..4e2d9b6 100644
--- a/fs/nfs/idmap.c
+++ b/fs/nfs/idmap.c
@@ -123,7 +123,7 @@ static ssize_t nfs_idmap_get_desc(const char *name, size_t namelen,
 	size_t desclen = typelen + namelen + 2;
 
 	*desc = kmalloc(desclen, GFP_KERNEL);
-	if (!desc)
+	if (!*desc)
 		return -ENOMEM;
 
 	cp = *desc;

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [patch] nfs: testing the wrong variable
@ 2010-10-28  6:05 ` Dan Carpenter
  0 siblings, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2010-10-28  6:05 UTC (permalink / raw)
  To: Trond Myklebust; +Cc: linux-nfs, kernel-janitors

The intent was to test "*desc" for allocation failures, but it tests
"desc" which is always a valid pointer here.

Signed-off-by: Dan Carpenter <error27@gmail.com>

diff --git a/fs/nfs/idmap.c b/fs/nfs/idmap.c
index dec47ed..4e2d9b6 100644
--- a/fs/nfs/idmap.c
+++ b/fs/nfs/idmap.c
@@ -123,7 +123,7 @@ static ssize_t nfs_idmap_get_desc(const char *name, size_t namelen,
 	size_t desclen = typelen + namelen + 2;
 
 	*desc = kmalloc(desclen, GFP_KERNEL);
-	if (!desc)
+	if (!*desc)
 		return -ENOMEM;
 
 	cp = *desc;

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [patch] nfs: testing the wrong variable
  2010-10-28  6:05 ` Dan Carpenter
@ 2010-10-28 18:18   ` Trond Myklebust
  -1 siblings, 0 replies; 4+ messages in thread
From: Trond Myklebust @ 2010-10-28 18:18 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: linux-nfs, kernel-janitors

On Thu, 2010-10-28 at 08:05 +0200, Dan Carpenter wrote:
> The intent was to test "*desc" for allocation failures, but it tests
> "desc" which is always a valid pointer here.
> 
> Signed-off-by: Dan Carpenter <error27@gmail.com>
> 
> diff --git a/fs/nfs/idmap.c b/fs/nfs/idmap.c
> index dec47ed..4e2d9b6 100644
> --- a/fs/nfs/idmap.c
> +++ b/fs/nfs/idmap.c
> @@ -123,7 +123,7 @@ static ssize_t nfs_idmap_get_desc(const char *name, size_t namelen,
>  	size_t desclen = typelen + namelen + 2;
>  
>  	*desc = kmalloc(desclen, GFP_KERNEL);
> -	if (!desc)
> +	if (!*desc)
>  		return -ENOMEM;
>  
>  	cp = *desc;

Thanks! Applied!

Trond

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [patch] nfs: testing the wrong variable
@ 2010-10-28 18:18   ` Trond Myklebust
  0 siblings, 0 replies; 4+ messages in thread
From: Trond Myklebust @ 2010-10-28 18:18 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: linux-nfs, kernel-janitors

On Thu, 2010-10-28 at 08:05 +0200, Dan Carpenter wrote:
> The intent was to test "*desc" for allocation failures, but it tests
> "desc" which is always a valid pointer here.
> 
> Signed-off-by: Dan Carpenter <error27@gmail.com>
> 
> diff --git a/fs/nfs/idmap.c b/fs/nfs/idmap.c
> index dec47ed..4e2d9b6 100644
> --- a/fs/nfs/idmap.c
> +++ b/fs/nfs/idmap.c
> @@ -123,7 +123,7 @@ static ssize_t nfs_idmap_get_desc(const char *name, size_t namelen,
>  	size_t desclen = typelen + namelen + 2;
>  
>  	*desc = kmalloc(desclen, GFP_KERNEL);
> -	if (!desc)
> +	if (!*desc)
>  		return -ENOMEM;
>  
>  	cp = *desc;

Thanks! Applied!

Trond

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-10-28 18:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-10-28  6:05 [patch] nfs: testing the wrong variable Dan Carpenter
2010-10-28  6:05 ` Dan Carpenter
2010-10-28 18:18 ` Trond Myklebust
2010-10-28 18:18   ` Trond Myklebust

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.