All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 3/3] block: Change simple_strtol() to kstrtol()
@ 2018-06-22 11:39 Kitone Elvis Peter
  2018-06-22 11:45 ` kbuild test robot
  2018-06-22 19:51 ` Jens Axboe
  0 siblings, 2 replies; 3+ messages in thread
From: Kitone Elvis Peter @ 2018-06-22 11:39 UTC (permalink / raw)
  To: axboe; +Cc: linux-block, linux-kernel

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 <elviskitone@gmail.com>
---
 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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 3/3] block: Change simple_strtol() to kstrtol()
  2018-06-22 11:39 [PATCH 3/3] block: Change simple_strtol() to kstrtol() Kitone Elvis Peter
@ 2018-06-22 11:45 ` kbuild test robot
  2018-06-22 19:51 ` Jens Axboe
  1 sibling, 0 replies; 3+ messages in thread
From: kbuild test robot @ 2018-06-22 11:45 UTC (permalink / raw)
  To: Kitone Elvis Peter; +Cc: kbuild-all, axboe, linux-block, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 3313 bytes --]

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 <torvalds@ppc970.osdl.org>
:::::: CC: Linus Torvalds <torvalds@ppc970.osdl.org>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 38915 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 3/3] block: Change simple_strtol() to kstrtol()
  2018-06-22 11:39 [PATCH 3/3] block: Change simple_strtol() to kstrtol() Kitone Elvis Peter
  2018-06-22 11:45 ` kbuild test robot
@ 2018-06-22 19:51 ` Jens Axboe
  1 sibling, 0 replies; 3+ messages in thread
From: Jens Axboe @ 2018-06-22 19:51 UTC (permalink / raw)
  To: Kitone Elvis Peter; +Cc: linux-block, linux-kernel

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-06-22 19:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-22 11:39 [PATCH 3/3] block: Change simple_strtol() to kstrtol() Kitone Elvis Peter
2018-06-22 11:45 ` kbuild test robot
2018-06-22 19:51 ` Jens Axboe

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.