lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <202201282234.A43HZoSH-lkp@intel.com>
Date:   Fri, 28 Jan 2022 22:54:14 +0800
From:   kernel test robot <lkp@...el.com>
To:     cgel.zte@...il.com, stefanr@...6.in-berlin.de
Cc:     kbuild-all@...ts.01.org, linux1394-devel@...ts.sourceforge.net,
        linux-kernel@...r.kernel.org, Minghao Chi <chi.minghao@....com.cn>,
        Zeal Robot <zealci@....com.cn>
Subject: Re: [PATCH] drivers/firewire: use struct_size over open coded
 arithmetic

Hi,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on ieee1394-linux1394/for-next]
[also build test ERROR on v5.17-rc1 next-20220128]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/cgel-zte-gmail-com/drivers-firewire-use-struct_size-over-open-coded-arithmetic/20220128-160602
base:   https://git.kernel.org/pub/scm/linux/kernel/git/ieee1394/linux1394.git for-next
config: arm-randconfig-c002-20220124 (https://download.01.org/0day-ci/archive/20220128/202201282234.A43HZoSH-lkp@intel.com/config)
compiler: arm-linux-gnueabi-gcc (GCC) 11.2.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/1567c3f747219c35e83d9c1f4ac3c3d36f447d90
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review cgel-zte-gmail-com/drivers-firewire-use-struct_size-over-open-coded-arithmetic/20220128-160602
        git checkout 1567c3f747219c35e83d9c1f4ac3c3d36f447d90
        # save the config file to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=arm SHELL=/bin/bash drivers/

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

All errors (new ones prefixed by >>):

   In file included from include/linux/device.h:29,
                    from drivers/firewire/core-transaction.c:10:
   drivers/firewire/core-transaction.c: In function 'allocate_request':
>> include/linux/overflow.h:326:32: error: invalid type argument of '->' (have 'struct fw_request')
     326 |                     sizeof(*(p)->member) + __must_be_array((p)->member),\
         |                                ^~
   drivers/firewire/core-transaction.c:780:27: note: in expansion of macro 'struct_size'
     780 |         request = kmalloc(struct_size(*request, data, length), GFP_ATOMIC);
         |                           ^~~~~~~~~~~
   In file included from include/linux/bits.h:22,
                    from include/linux/bitops.h:6,
                    from include/linux/kernel.h:12,
                    from include/asm-generic/bug.h:20,
                    from arch/arm/include/asm/bug.h:60,
                    from include/linux/bug.h:5,
                    from drivers/firewire/core-transaction.c:8:
   include/linux/overflow.h:326:63: error: invalid type argument of '->' (have 'struct fw_request')
     326 |                     sizeof(*(p)->member) + __must_be_array((p)->member),\
         |                                                               ^~
   include/linux/build_bug.h:16:62: note: in definition of macro 'BUILD_BUG_ON_ZERO'
      16 | #define BUILD_BUG_ON_ZERO(e) ((int)(sizeof(struct { int:(-!!(e)); })))
         |                                                              ^
   include/linux/compiler.h:240:51: note: in expansion of macro '__same_type'
     240 | #define __must_be_array(a)      BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0]))
         |                                                   ^~~~~~~~~~~
   include/linux/overflow.h:326:44: note: in expansion of macro '__must_be_array'
     326 |                     sizeof(*(p)->member) + __must_be_array((p)->member),\
         |                                            ^~~~~~~~~~~~~~~
   drivers/firewire/core-transaction.c:780:27: note: in expansion of macro 'struct_size'
     780 |         request = kmalloc(struct_size(*request, data, length), GFP_ATOMIC);
         |                           ^~~~~~~~~~~
   include/linux/overflow.h:326:63: error: invalid type argument of '->' (have 'struct fw_request')
     326 |                     sizeof(*(p)->member) + __must_be_array((p)->member),\
         |                                                               ^~
   include/linux/build_bug.h:16:62: note: in definition of macro 'BUILD_BUG_ON_ZERO'
      16 | #define BUILD_BUG_ON_ZERO(e) ((int)(sizeof(struct { int:(-!!(e)); })))
         |                                                              ^
   include/linux/compiler.h:240:51: note: in expansion of macro '__same_type'
     240 | #define __must_be_array(a)      BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0]))
         |                                                   ^~~~~~~~~~~
   include/linux/overflow.h:326:44: note: in expansion of macro '__must_be_array'
     326 |                     sizeof(*(p)->member) + __must_be_array((p)->member),\
         |                                            ^~~~~~~~~~~~~~~
   drivers/firewire/core-transaction.c:780:27: note: in expansion of macro 'struct_size'
     780 |         request = kmalloc(struct_size(*request, data, length), GFP_ATOMIC);
         |                           ^~~~~~~~~~~
   include/linux/build_bug.h:16:51: error: bit-field '<anonymous>' width not an integer constant
      16 | #define BUILD_BUG_ON_ZERO(e) ((int)(sizeof(struct { int:(-!!(e)); })))
         |                                                   ^
   include/linux/compiler.h:240:33: note: in expansion of macro 'BUILD_BUG_ON_ZERO'
     240 | #define __must_be_array(a)      BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0]))
         |                                 ^~~~~~~~~~~~~~~~~
   include/linux/overflow.h:326:44: note: in expansion of macro '__must_be_array'
     326 |                     sizeof(*(p)->member) + __must_be_array((p)->member),\
         |                                            ^~~~~~~~~~~~~~~
   drivers/firewire/core-transaction.c:780:27: note: in expansion of macro 'struct_size'
     780 |         request = kmalloc(struct_size(*request, data, length), GFP_ATOMIC);
         |                           ^~~~~~~~~~~
   In file included from include/linux/device.h:29,
                    from drivers/firewire/core-transaction.c:10:
>> include/linux/overflow.h:327:28: error: invalid type argument of unary '*' (have 'struct fw_request')
     327 |                     sizeof(*(p)))
         |                            ^~~~
   drivers/firewire/core-transaction.c:780:27: note: in expansion of macro 'struct_size'
     780 |         request = kmalloc(struct_size(*request, data, length), GFP_ATOMIC);
         |                           ^~~~~~~~~~~


vim +326 include/linux/overflow.h

610b15c50e86eb1 Kees Cook           2018-05-07  312  
610b15c50e86eb1 Kees Cook           2018-05-07  313  /**
610b15c50e86eb1 Kees Cook           2018-05-07  314   * struct_size() - Calculate size of structure with trailing array.
610b15c50e86eb1 Kees Cook           2018-05-07  315   * @p: Pointer to the structure.
610b15c50e86eb1 Kees Cook           2018-05-07  316   * @member: Name of the array member.
b19d57d0f3cc6f1 Gustavo A. R. Silva 2020-06-08  317   * @count: Number of elements in the array.
610b15c50e86eb1 Kees Cook           2018-05-07  318   *
610b15c50e86eb1 Kees Cook           2018-05-07  319   * Calculates size of memory needed for structure @p followed by an
b19d57d0f3cc6f1 Gustavo A. R. Silva 2020-06-08  320   * array of @count number of @member elements.
610b15c50e86eb1 Kees Cook           2018-05-07  321   *
610b15c50e86eb1 Kees Cook           2018-05-07  322   * Return: number of bytes needed or SIZE_MAX on overflow.
610b15c50e86eb1 Kees Cook           2018-05-07  323   */
b19d57d0f3cc6f1 Gustavo A. R. Silva 2020-06-08  324  #define struct_size(p, member, count)					\
b19d57d0f3cc6f1 Gustavo A. R. Silva 2020-06-08  325  	__ab_c_size(count,						\
610b15c50e86eb1 Kees Cook           2018-05-07 @326  		    sizeof(*(p)->member) + __must_be_array((p)->member),\
610b15c50e86eb1 Kees Cook           2018-05-07 @327  		    sizeof(*(p)))
610b15c50e86eb1 Kees Cook           2018-05-07  328  

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ