Skip to content

Commit 09c9feb

Browse files
error27torvalds
authored andcommitted
Documentation: make configfs example code simpler, clearer
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> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 2b35f4d commit 09c9feb

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎Documentation/filesystems/configfs/configfs_example_explicit.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ static ssize_t childless_storeme_write(struct childless *childless,
8989
char *p = (char *) page;
9090

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

9595
if (tmp > INT_MAX)

0 commit comments

Comments
 (0)