Re: [PATCH -next v2] nbd: add the check to prevent overflow in __nbd_ioctl()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Baokun,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on next-20210730]

url:    https://github.com/0day-ci/linux/commits/Baokun-Li/nbd-add-the-check-to-prevent-overflow-in-__nbd_ioctl/20210802-154727
base:    8d4b477da1a807199ca60e0829357ce7aa6758d5
config: sh-randconfig-r005-20210802 (attached as .config)
compiler: sh4-linux-gcc (GCC) 10.3.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/0day-ci/linux/commit/db848e3e79fb93dcba9390dda472184ab2d31f40
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Baokun-Li/nbd-add-the-check-to-prevent-overflow-in-__nbd_ioctl/20210802-154727
        git checkout db848e3e79fb93dcba9390dda472184ab2d31f40
        # save the attached .config to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-10.3.0 make.cross O=build_dir ARCH=sh SHELL=/bin/bash drivers/block/

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All warnings (new ones prefixed by >>):

   In file included from include/asm-generic/bug.h:5,
                    from arch/sh/include/asm/bug.h:112,
                    from include/linux/bug.h:5,
                    from include/linux/thread_info.h:13,
                    from include/asm-generic/current.h:5,
                    from ./arch/sh/include/generated/asm/current.h:1,
                    from include/linux/sched.h:12,
                    from include/linux/blkdev.h:5,
                    from drivers/block/nbd.c:16:
   drivers/block/nbd.c: In function '__nbd_ioctl':
>> include/linux/overflow.h:88:15: warning: comparison of distinct pointer types lacks a cast
      88 |  (void) (&__a == &__b);   \
         |               ^~
   include/linux/compiler.h:78:42: note: in definition of macro 'unlikely'
      78 | # define unlikely(x) __builtin_expect(!!(x), 0)
         |                                          ^
   drivers/block/nbd.c:1402:16: note: in expansion of macro 'check_mul_overflow'
    1402 |   if (unlikely(check_mul_overflow(arg, config->blksize,
         |                ^~~~~~~~~~~~~~~~~~
   include/linux/overflow.h:89:15: warning: comparison of distinct pointer types lacks a cast
      89 |  (void) (&__a == __d);   \
         |               ^~
   include/linux/compiler.h:78:42: note: in definition of macro 'unlikely'
      78 | # define unlikely(x) __builtin_expect(!!(x), 0)
         |                                          ^
   drivers/block/nbd.c:1402:16: note: in expansion of macro 'check_mul_overflow'
    1402 |   if (unlikely(check_mul_overflow(arg, config->blksize,
         |                ^~~~~~~~~~~~~~~~~~


vim +88 include/linux/overflow.h

f0907827a8a915 Rasmus Villemoes 2018-05-08  83  
9b80e4c4ddaca3 Kees Cook        2020-08-12  84  #define check_mul_overflow(a, b, d) __must_check_overflow(({	\
f0907827a8a915 Rasmus Villemoes 2018-05-08  85  	typeof(a) __a = (a);			\
f0907827a8a915 Rasmus Villemoes 2018-05-08  86  	typeof(b) __b = (b);			\
f0907827a8a915 Rasmus Villemoes 2018-05-08  87  	typeof(d) __d = (d);			\
f0907827a8a915 Rasmus Villemoes 2018-05-08 @88  	(void) (&__a == &__b);			\
f0907827a8a915 Rasmus Villemoes 2018-05-08  89  	(void) (&__a == __d);			\
f0907827a8a915 Rasmus Villemoes 2018-05-08  90  	__builtin_mul_overflow(__a, __b, __d);	\
9b80e4c4ddaca3 Kees Cook        2020-08-12  91  }))
f0907827a8a915 Rasmus Villemoes 2018-05-08  92  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip


[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux