All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: kbuild-all@lists.01.org
Subject: Re: [PATCH] drivers/firewire: use struct_size over open coded arithmetic
Date: Fri, 28 Jan 2022 22:54:14 +0800	[thread overview]
Message-ID: <202201282234.A43HZoSH-lkp@intel.com> (raw)
In-Reply-To: <20220128080336.1211525-1-chi.minghao@zte.com.cn>

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

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(a)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@intel.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(a)lists.01.org

      parent reply	other threads:[~2022-01-28 14:54 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20220128080336.1211525-1-chi.minghao@zte.com.cn>
2022-01-28 12:08 ` [PATCH] drivers/firewire: use struct_size over open coded arithmetic kernel test robot
2022-01-28 12:08   ` kernel test robot
2022-01-28 14:54 ` kernel test robot [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202201282234.A43HZoSH-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=kbuild-all@lists.01.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.