lkml.org 
[lkml]   [2010]   [Nov]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH 2/7] Documentation: make configfs example code simpler, clearer
From: Dan Carpenter <error27@gmail.com>

If "p" is NULL then it will cause an oops when we pass it to
simple_strtoul(). In this case "p" can not be NULL so I removed the
check. I also changed the check a little to make it more explicit that
we are testing whether p points to the NUL char.

Signed-off-by: Dan Carpenter <error27@gmail.com>
Acked-by: Joel Becker <joel.becker@oracle.com>
Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
---
V2: Added some parenthesis to make the precedence more clear.

---
Documentation/filesystems/configfs/configfs_example_explicit.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

--- linux-2.6.37-rc2-git4.orig/Documentation/filesystems/configfs/configfs_example_explicit.c
+++ linux-2.6.37-rc2-git4/Documentation/filesystems/configfs/configfs_example_explicit.c
@@ -89,7 +89,7 @@ static ssize_t childless_storeme_write(s
char *p = (char *) page;

tmp = simple_strtoul(p, &p, 10);
- if (!p || (*p && (*p != '\n')))
+ if ((*p != '\0') && (*p != '\n'))
return -EINVAL;

if (tmp > INT_MAX)

--



\
 
 \ /
  Last update: 2010-11-18 21:37    [W:0.495 / U:0.108 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site