From: kernel test robot <lkp@intel.com>
To: cgel.zte@gmail.com, davem@davemloft.net
Cc: llvm@lists.linux.dev, kbuild-all@lists.01.org, kuba@kernel.org,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
Minghao Chi <chi.minghao@zte.com.cn>,
Zeal Robot <zealci@zte.com.cn>
Subject: Re: [PATCH] net/802: use struct_size over open coded arithmetic
Date: Fri, 28 Jan 2022 20:40:51 +0800 [thread overview]
Message-ID: <202201282017.0TQvVTtf-lkp@intel.com> (raw)
In-Reply-To: <20220128080541.1211668-1-chi.minghao@zte.com.cn>
Hi,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on net-next/master]
[also build test ERROR on net/master horms-ipvs/master linus/master 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/net-802-use-struct_size-over-open-coded-arithmetic/20220128-160925
base: https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git 72d044e4bfa6bd9096536e2e1c62aecfe1a525e4
config: riscv-randconfig-r042-20220124 (https://download.01.org/0day-ci/archive/20220128/202201282017.0TQvVTtf-lkp@intel.com/config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 33b45ee44b1f32ffdbc995e6fec806271b4b3ba4)
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
# install riscv cross compiling tool for clang build
# apt-get install binutils-riscv64-linux-gnu
# https://github.com/0day-ci/linux/commit/9b64e5078d3d779fc56432d43129479f63996c74
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review cgel-zte-gmail-com/net-802-use-struct_size-over-open-coded-arithmetic/20220128-160925
git checkout 9b64e5078d3d779fc56432d43129479f63996c74
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=riscv SHELL=/bin/bash drivers/net/wireless/ath/wcn36xx/ net/802/
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 >>):
>> net/802/garp.c:187:17: error: member reference type 'struct garp_attr' is not a pointer; did you mean to use '.'?
attr = kmalloc(struct_size(*attr, data, len), GFP_ATOMIC);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/overflow.h:194:18: note: expanded from macro 'struct_size'
sizeof(*(p)->member) + __must_be_array((p)->member),\
~~~^
>> net/802/garp.c:187:17: error: indirection requires pointer operand ('unsigned char[]' invalid)
attr = kmalloc(struct_size(*attr, data, len), GFP_ATOMIC);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/overflow.h:194:14: note: expanded from macro 'struct_size'
sizeof(*(p)->member) + __must_be_array((p)->member),\
^~~~~~~~~~~~
>> net/802/garp.c:187:17: error: member reference type 'struct garp_attr' is not a pointer; did you mean to use '.'?
attr = kmalloc(struct_size(*attr, data, len), GFP_ATOMIC);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/overflow.h:194:49: note: expanded from macro 'struct_size'
sizeof(*(p)->member) + __must_be_array((p)->member),\
~~~~~~~~~~~~~~~~~~~^~~~~~~~~
include/linux/compiler.h:258:59: note: expanded from macro '__must_be_array'
#define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0]))
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
include/linux/compiler_types.h:287:63: note: expanded from macro '__same_type'
#define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b))
^
include/linux/build_bug.h:16:62: note: expanded from macro 'BUILD_BUG_ON_ZERO'
#define BUILD_BUG_ON_ZERO(e) ((int)(sizeof(struct { int:(-!!(e)); })))
^
>> net/802/garp.c:187:17: error: member reference type 'struct garp_attr' is not a pointer; did you mean to use '.'?
attr = kmalloc(struct_size(*attr, data, len), GFP_ATOMIC);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/overflow.h:194:49: note: expanded from macro 'struct_size'
sizeof(*(p)->member) + __must_be_array((p)->member),\
~~~~~~~~~~~~~~~~~~~^~~~~~~~~
include/linux/compiler.h:258:65: note: expanded from macro '__must_be_array'
#define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0]))
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
include/linux/compiler_types.h:287:74: note: expanded from macro '__same_type'
#define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b))
^
include/linux/build_bug.h:16:62: note: expanded from macro 'BUILD_BUG_ON_ZERO'
#define BUILD_BUG_ON_ZERO(e) ((int)(sizeof(struct { int:(-!!(e)); })))
^
>> net/802/garp.c:187:17: error: indirection requires pointer operand ('struct garp_attr' invalid)
attr = kmalloc(struct_size(*attr, data, len), GFP_ATOMIC);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/overflow.h:195:14: note: expanded from macro 'struct_size'
sizeof(*(p)))
^~~~
5 errors generated.
--
>> net/802/mrp.c:276:17: error: member reference type 'struct mrp_attr' is not a pointer; did you mean to use '.'?
attr = kmalloc(struct_size(*attr, value, len), GFP_ATOMIC);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/overflow.h:194:18: note: expanded from macro 'struct_size'
sizeof(*(p)->member) + __must_be_array((p)->member),\
~~~^
>> net/802/mrp.c:276:17: error: indirection requires pointer operand ('unsigned char[]' invalid)
attr = kmalloc(struct_size(*attr, value, len), GFP_ATOMIC);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/overflow.h:194:14: note: expanded from macro 'struct_size'
sizeof(*(p)->member) + __must_be_array((p)->member),\
^~~~~~~~~~~~
>> net/802/mrp.c:276:17: error: member reference type 'struct mrp_attr' is not a pointer; did you mean to use '.'?
attr = kmalloc(struct_size(*attr, value, len), GFP_ATOMIC);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/overflow.h:194:49: note: expanded from macro 'struct_size'
sizeof(*(p)->member) + __must_be_array((p)->member),\
~~~~~~~~~~~~~~~~~~~^~~~~~~~~
include/linux/compiler.h:258:59: note: expanded from macro '__must_be_array'
#define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0]))
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
include/linux/compiler_types.h:287:63: note: expanded from macro '__same_type'
#define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b))
^
include/linux/build_bug.h:16:62: note: expanded from macro 'BUILD_BUG_ON_ZERO'
#define BUILD_BUG_ON_ZERO(e) ((int)(sizeof(struct { int:(-!!(e)); })))
^
>> net/802/mrp.c:276:17: error: member reference type 'struct mrp_attr' is not a pointer; did you mean to use '.'?
attr = kmalloc(struct_size(*attr, value, len), GFP_ATOMIC);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/overflow.h:194:49: note: expanded from macro 'struct_size'
sizeof(*(p)->member) + __must_be_array((p)->member),\
~~~~~~~~~~~~~~~~~~~^~~~~~~~~
include/linux/compiler.h:258:65: note: expanded from macro '__must_be_array'
#define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0]))
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
include/linux/compiler_types.h:287:74: note: expanded from macro '__same_type'
#define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b))
^
include/linux/build_bug.h:16:62: note: expanded from macro 'BUILD_BUG_ON_ZERO'
#define BUILD_BUG_ON_ZERO(e) ((int)(sizeof(struct { int:(-!!(e)); })))
^
>> net/802/mrp.c:276:17: error: indirection requires pointer operand ('struct mrp_attr' invalid)
attr = kmalloc(struct_size(*attr, value, len), GFP_ATOMIC);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/overflow.h:195:14: note: expanded from macro 'struct_size'
sizeof(*(p)))
^~~~
5 errors generated.
vim +187 net/802/garp.c
166
167 static struct garp_attr *garp_attr_create(struct garp_applicant *app,
168 const void *data, u8 len, u8 type)
169 {
170 struct rb_node *parent = NULL, **p = &app->gid.rb_node;
171 struct garp_attr *attr;
172 int d;
173
174 while (*p) {
175 parent = *p;
176 attr = rb_entry(parent, struct garp_attr, node);
177 d = garp_attr_cmp(attr, data, len, type);
178 if (d > 0)
179 p = &parent->rb_left;
180 else if (d < 0)
181 p = &parent->rb_right;
182 else {
183 /* The attribute already exists; re-use it. */
184 return attr;
185 }
186 }
> 187 attr = kmalloc(struct_size(*attr, data, len), GFP_ATOMIC);
188 if (!attr)
189 return attr;
190 attr->state = GARP_APPLICANT_VO;
191 attr->type = type;
192 attr->dlen = len;
193 memcpy(attr->data, data, len);
194
195 rb_link_node(&attr->node, parent, p);
196 rb_insert_color(&attr->node, &app->gid);
197 return attr;
198 }
199
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
WARNING: multiple messages have this Message-ID (diff)
From: kernel test robot <lkp@intel.com>
To: kbuild-all@lists.01.org
Subject: Re: [PATCH] net/802: use struct_size over open coded arithmetic
Date: Fri, 28 Jan 2022 20:40:51 +0800 [thread overview]
Message-ID: <202201282017.0TQvVTtf-lkp@intel.com> (raw)
In-Reply-To: <20220128080541.1211668-1-chi.minghao@zte.com.cn>
[-- Attachment #1: Type: text/plain, Size: 10400 bytes --]
Hi,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on net-next/master]
[also build test ERROR on net/master horms-ipvs/master linus/master 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/net-802-use-struct_size-over-open-coded-arithmetic/20220128-160925
base: https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git 72d044e4bfa6bd9096536e2e1c62aecfe1a525e4
config: riscv-randconfig-r042-20220124 (https://download.01.org/0day-ci/archive/20220128/202201282017.0TQvVTtf-lkp(a)intel.com/config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 33b45ee44b1f32ffdbc995e6fec806271b4b3ba4)
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
# install riscv cross compiling tool for clang build
# apt-get install binutils-riscv64-linux-gnu
# https://github.com/0day-ci/linux/commit/9b64e5078d3d779fc56432d43129479f63996c74
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review cgel-zte-gmail-com/net-802-use-struct_size-over-open-coded-arithmetic/20220128-160925
git checkout 9b64e5078d3d779fc56432d43129479f63996c74
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=riscv SHELL=/bin/bash drivers/net/wireless/ath/wcn36xx/ net/802/
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 >>):
>> net/802/garp.c:187:17: error: member reference type 'struct garp_attr' is not a pointer; did you mean to use '.'?
attr = kmalloc(struct_size(*attr, data, len), GFP_ATOMIC);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/overflow.h:194:18: note: expanded from macro 'struct_size'
sizeof(*(p)->member) + __must_be_array((p)->member),\
~~~^
>> net/802/garp.c:187:17: error: indirection requires pointer operand ('unsigned char[]' invalid)
attr = kmalloc(struct_size(*attr, data, len), GFP_ATOMIC);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/overflow.h:194:14: note: expanded from macro 'struct_size'
sizeof(*(p)->member) + __must_be_array((p)->member),\
^~~~~~~~~~~~
>> net/802/garp.c:187:17: error: member reference type 'struct garp_attr' is not a pointer; did you mean to use '.'?
attr = kmalloc(struct_size(*attr, data, len), GFP_ATOMIC);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/overflow.h:194:49: note: expanded from macro 'struct_size'
sizeof(*(p)->member) + __must_be_array((p)->member),\
~~~~~~~~~~~~~~~~~~~^~~~~~~~~
include/linux/compiler.h:258:59: note: expanded from macro '__must_be_array'
#define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0]))
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
include/linux/compiler_types.h:287:63: note: expanded from macro '__same_type'
#define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b))
^
include/linux/build_bug.h:16:62: note: expanded from macro 'BUILD_BUG_ON_ZERO'
#define BUILD_BUG_ON_ZERO(e) ((int)(sizeof(struct { int:(-!!(e)); })))
^
>> net/802/garp.c:187:17: error: member reference type 'struct garp_attr' is not a pointer; did you mean to use '.'?
attr = kmalloc(struct_size(*attr, data, len), GFP_ATOMIC);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/overflow.h:194:49: note: expanded from macro 'struct_size'
sizeof(*(p)->member) + __must_be_array((p)->member),\
~~~~~~~~~~~~~~~~~~~^~~~~~~~~
include/linux/compiler.h:258:65: note: expanded from macro '__must_be_array'
#define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0]))
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
include/linux/compiler_types.h:287:74: note: expanded from macro '__same_type'
#define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b))
^
include/linux/build_bug.h:16:62: note: expanded from macro 'BUILD_BUG_ON_ZERO'
#define BUILD_BUG_ON_ZERO(e) ((int)(sizeof(struct { int:(-!!(e)); })))
^
>> net/802/garp.c:187:17: error: indirection requires pointer operand ('struct garp_attr' invalid)
attr = kmalloc(struct_size(*attr, data, len), GFP_ATOMIC);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/overflow.h:195:14: note: expanded from macro 'struct_size'
sizeof(*(p)))
^~~~
5 errors generated.
--
>> net/802/mrp.c:276:17: error: member reference type 'struct mrp_attr' is not a pointer; did you mean to use '.'?
attr = kmalloc(struct_size(*attr, value, len), GFP_ATOMIC);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/overflow.h:194:18: note: expanded from macro 'struct_size'
sizeof(*(p)->member) + __must_be_array((p)->member),\
~~~^
>> net/802/mrp.c:276:17: error: indirection requires pointer operand ('unsigned char[]' invalid)
attr = kmalloc(struct_size(*attr, value, len), GFP_ATOMIC);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/overflow.h:194:14: note: expanded from macro 'struct_size'
sizeof(*(p)->member) + __must_be_array((p)->member),\
^~~~~~~~~~~~
>> net/802/mrp.c:276:17: error: member reference type 'struct mrp_attr' is not a pointer; did you mean to use '.'?
attr = kmalloc(struct_size(*attr, value, len), GFP_ATOMIC);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/overflow.h:194:49: note: expanded from macro 'struct_size'
sizeof(*(p)->member) + __must_be_array((p)->member),\
~~~~~~~~~~~~~~~~~~~^~~~~~~~~
include/linux/compiler.h:258:59: note: expanded from macro '__must_be_array'
#define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0]))
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
include/linux/compiler_types.h:287:63: note: expanded from macro '__same_type'
#define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b))
^
include/linux/build_bug.h:16:62: note: expanded from macro 'BUILD_BUG_ON_ZERO'
#define BUILD_BUG_ON_ZERO(e) ((int)(sizeof(struct { int:(-!!(e)); })))
^
>> net/802/mrp.c:276:17: error: member reference type 'struct mrp_attr' is not a pointer; did you mean to use '.'?
attr = kmalloc(struct_size(*attr, value, len), GFP_ATOMIC);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/overflow.h:194:49: note: expanded from macro 'struct_size'
sizeof(*(p)->member) + __must_be_array((p)->member),\
~~~~~~~~~~~~~~~~~~~^~~~~~~~~
include/linux/compiler.h:258:65: note: expanded from macro '__must_be_array'
#define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0]))
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
include/linux/compiler_types.h:287:74: note: expanded from macro '__same_type'
#define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b))
^
include/linux/build_bug.h:16:62: note: expanded from macro 'BUILD_BUG_ON_ZERO'
#define BUILD_BUG_ON_ZERO(e) ((int)(sizeof(struct { int:(-!!(e)); })))
^
>> net/802/mrp.c:276:17: error: indirection requires pointer operand ('struct mrp_attr' invalid)
attr = kmalloc(struct_size(*attr, value, len), GFP_ATOMIC);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/overflow.h:195:14: note: expanded from macro 'struct_size'
sizeof(*(p)))
^~~~
5 errors generated.
vim +187 net/802/garp.c
166
167 static struct garp_attr *garp_attr_create(struct garp_applicant *app,
168 const void *data, u8 len, u8 type)
169 {
170 struct rb_node *parent = NULL, **p = &app->gid.rb_node;
171 struct garp_attr *attr;
172 int d;
173
174 while (*p) {
175 parent = *p;
176 attr = rb_entry(parent, struct garp_attr, node);
177 d = garp_attr_cmp(attr, data, len, type);
178 if (d > 0)
179 p = &parent->rb_left;
180 else if (d < 0)
181 p = &parent->rb_right;
182 else {
183 /* The attribute already exists; re-use it. */
184 return attr;
185 }
186 }
> 187 attr = kmalloc(struct_size(*attr, data, len), GFP_ATOMIC);
188 if (!attr)
189 return attr;
190 attr->state = GARP_APPLICANT_VO;
191 attr->type = type;
192 attr->dlen = len;
193 memcpy(attr->data, data, len);
194
195 rb_link_node(&attr->node, parent, p);
196 rb_insert_color(&attr->node, &app->gid);
197 return attr;
198 }
199
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
next prev parent reply other threads:[~2022-01-28 12:41 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-28 8:05 [PATCH] net/802: use struct_size over open coded arithmetic cgel.zte
2022-01-28 12:40 ` kernel test robot [this message]
2022-01-28 12:40 ` kernel test robot
2022-01-28 12:51 ` kernel test robot
2022-01-28 12:51 ` kernel test robot
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=202201282017.0TQvVTtf-lkp@intel.com \
--to=lkp@intel.com \
--cc=cgel.zte@gmail.com \
--cc=chi.minghao@zte.com.cn \
--cc=davem@davemloft.net \
--cc=kbuild-all@lists.01.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=llvm@lists.linux.dev \
--cc=netdev@vger.kernel.org \
--cc=zealci@zte.com.cn \
/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.