The usage of simple_strtol is discouraged, because
strtol() is obsolete. Instead kstrtol() should be
used to convert a string into a long integer.
Signed-off-by: Kitone Elvis Peter <[email protected]>
---
drivers/block/brd.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/block/brd.c b/drivers/block/brd.c
index e2a1278..4b7a28e 100644
--- a/drivers/block/brd.c
+++ b/drivers/block/brd.c
@@ -351,7 +351,7 @@ MODULE_ALIAS("rd");
/* Legacy boot options - nonmodular */
static int __init ramdisk_size(char *str)
{
- rd_size = simple_strtol(str, NULL, 0);
+ rd_size = kstrtol(str, NULL, 0);
return 1;
}
__setup("ramdisk_size=", ramdisk_size);
--
2.7.4
Hi Kitone,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on v4.17]
[cannot apply to linus/master block/for-next v4.18-rc1 next-20180622]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Kitone-Elvis-Peter/block-Use-SPDX-License-Identifier/20180622-192459
config: x86_64-randconfig-x007-201824 (attached as .config)
compiler: gcc-7 (Debian 7.3.0-16) 7.3.0
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64
All warnings (new ones prefixed by >>):
In file included from include/uapi/linux/posix_types.h:5:0,
from include/uapi/linux/types.h:14,
from include/linux/compiler.h:169,
from include/linux/init.h:5,
from drivers//block/brd.c:12:
drivers//block/brd.c: In function 'ramdisk_size':
>> include/linux/stddef.h:8:14: warning: passing argument 2 of 'kstrtol' makes integer from pointer without a cast [-Wint-conversion]
#define NULL ((void *)0)
^
>> drivers//block/brd.c:354:25: note: in expansion of macro 'NULL'
rd_size = kstrtol(str, NULL, 0);
^~~~
In file included from include/linux/list.h:9:0,
from include/linux/module.h:9,
from drivers//block/brd.c:14:
include/linux/kernel.h:361:32: note: expected 'unsigned int' but argument is of type 'void *'
static inline int __must_check kstrtol(const char *s, unsigned int base, long *res)
^~~~~~~
--
In file included from include/uapi/linux/posix_types.h:5:0,
from include/uapi/linux/types.h:14,
from include/linux/compiler.h:169,
from include/linux/init.h:5,
from drivers/block/brd.c:12:
drivers/block/brd.c: In function 'ramdisk_size':
>> include/linux/stddef.h:8:14: warning: passing argument 2 of 'kstrtol' makes integer from pointer without a cast [-Wint-conversion]
#define NULL ((void *)0)
^
drivers/block/brd.c:354:25: note: in expansion of macro 'NULL'
rd_size = kstrtol(str, NULL, 0);
^~~~
In file included from include/linux/list.h:9:0,
from include/linux/module.h:9,
from drivers/block/brd.c:14:
include/linux/kernel.h:361:32: note: expected 'unsigned int' but argument is of type 'void *'
static inline int __must_check kstrtol(const char *s, unsigned int base, long *res)
^~~~~~~
vim +/kstrtol +8 include/linux/stddef.h
^1da177e Linus Torvalds 2005-04-16 6
^1da177e Linus Torvalds 2005-04-16 7 #undef NULL
^1da177e Linus Torvalds 2005-04-16 @8 #define NULL ((void *)0)
6e218287 Richard Knutsson 2006-09-30 9
:::::: The code at line 8 was first introduced by commit
:::::: 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 Linux-2.6.12-rc2
:::::: TO: Linus Torvalds <[email protected]>
:::::: CC: Linus Torvalds <[email protected]>
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
On 6/22/18 5:39 AM, Kitone Elvis Peter wrote:
> The usage of simple_strtol is discouraged, because
> strtol() is obsolete. Instead kstrtol() should be
> used to convert a string into a long integer.
My patience is running pretty thin with you. Don't send untested
crap, you haven't even compiled this.
--
Jens Axboe