Skip to contentSkip to conversation

nfs: testing the wrong variable

PATCH Applied Dan Carpenter 2 participants 2 messages Oct 28, 2010

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 nfs: testing the wrong variable

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

fs/nfs/idmap.c +1 -1
index dec47ed..4e2d9b6 100644
@@ -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;
#1 lore raw
Quoted 10 lines · Dan Carpenter

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

fs/nfs/idmap.c +0 -0
index dec47ed..4e2d9b6 100644

fs/nfs/idmap.c static ssize_t nfs_idmap_get_desc(const char *name, size_t namelen, · line 129

Quoted 8 lines
fs/nfs/idmap.c +1 -1
@@ -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