L Liu Shixin #
Message details and related content
The simple_strtol() function is deprecated in some situation since it does not check for the range overflow. Use kstrtoint()/kstrtoul() instead. Attention, if the end of the input string isn't '\n', simple_strtol() will ignore following characters and return the value but kstrtoint()/kstrtoul() will return an error code. Signed-off-by: Liu Shixin <redacted> --- drivers/block/brd.c | 3 +-- drivers/block/loop.c | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/block/brd.c b/drivers/block/brd.c
index 7562cf30b14e..5b43f6b2d506 100644
--- a/drivers/block/brd.c
+++ b/drivers/block/brd.c@@ -358,8 +358,7 @@ MODULE_ALIAS("rd"); /* Legacy boot options - nonmodular */ static int __init ramdisk_size(char *str) { - rd_size = simple_strtol(str, NULL, 0); - return 1; + return !kstrtoul(str, 0, &rd_size); } __setup("ramdisk_size=", ramdisk_size); #endif
diff --git a/drivers/block/loop.c b/drivers/block/loop.c
index d58d68f3c7cd..9fe595afa9cf 100644
--- a/drivers/block/loop.c
+++ b/drivers/block/loop.c@@ -2415,8 +2415,7 @@ module_exit(loop_exit); #ifndef MODULE static int __init max_loop_setup(char *str) { - max_loop = simple_strtol(str, NULL, 0); - return 1; + return !kstrtoint(str, 0, &max_loop); } __setup("max_loop=", max_loop_setup);
--
2.18.0.huawei.25