From: kernel test robot <lkp@intel.com>
To: cgel.zte@gmail.com, stefanr@s5r6.in-berlin.de
Cc: llvm@lists.linux.dev, kbuild-all@lists.01.org,
linux1394-devel@lists.sourceforge.net,
linux-kernel@vger.kernel.org,
Minghao Chi <chi.minghao@zte.com.cn>,
Zeal Robot <zealci@zte.com.cn>
Subject: Re: [PATCH] drivers/firewire: use struct_size over open coded arithmetic
Date: Fri, 28 Jan 2022 20:08:57 +0800 [thread overview]
Message-ID: <202201282044.Ye1mhIOd-lkp@intel.com> (raw)
In-Reply-To: <20220128080336.1211525-1-chi.minghao@zte.com.cn>
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: hexagon-randconfig-r015-20220128 (https://download.01.org/0day-ci/archive/20220128/202201282044.Ye1mhIOd-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
# 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=clang make.cross W=1 O=build_dir ARCH=hexagon SHELL=/bin/bash drivers/firewire/
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 >>):
>> drivers/firewire/core-transaction.c:780:20: error: member reference type 'struct fw_request' is not a pointer; did you mean to use '.'?
request = kmalloc(struct_size(*request, data, length), GFP_ATOMIC);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/overflow.h:326:18: note: expanded from macro 'struct_size'
sizeof(*(p)->member) + __must_be_array((p)->member),\
~~~^
>> drivers/firewire/core-transaction.c:780:20: error: indirection requires pointer operand ('u32[]' (aka 'unsigned int[]') invalid)
request = kmalloc(struct_size(*request, data, length), GFP_ATOMIC);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/overflow.h:326:14: note: expanded from macro 'struct_size'
sizeof(*(p)->member) + __must_be_array((p)->member),\
^~~~~~~~~~~~
>> drivers/firewire/core-transaction.c:780:20: error: member reference type 'struct fw_request' is not a pointer; did you mean to use '.'?
request = kmalloc(struct_size(*request, data, length), GFP_ATOMIC);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/overflow.h:326:49: note: expanded from macro 'struct_size'
sizeof(*(p)->member) + __must_be_array((p)->member),\
~~~~~~~~~~~~~~~~~~~^~~~~~~~~
include/linux/compiler.h:240: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:264: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)); })))
^
>> drivers/firewire/core-transaction.c:780:20: error: member reference type 'struct fw_request' is not a pointer; did you mean to use '.'?
request = kmalloc(struct_size(*request, data, length), GFP_ATOMIC);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/overflow.h:326:49: note: expanded from macro 'struct_size'
sizeof(*(p)->member) + __must_be_array((p)->member),\
~~~~~~~~~~~~~~~~~~~^~~~~~~~~
include/linux/compiler.h:240: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:264: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)); })))
^
>> drivers/firewire/core-transaction.c:780:20: error: indirection requires pointer operand ('struct fw_request' invalid)
request = kmalloc(struct_size(*request, data, length), GFP_ATOMIC);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/overflow.h:327:14: note: expanded from macro 'struct_size'
sizeof(*(p)))
^~~~
5 errors generated.
vim +780 drivers/firewire/core-transaction.c
743
744 static struct fw_request *allocate_request(struct fw_card *card,
745 struct fw_packet *p)
746 {
747 struct fw_request *request;
748 u32 *data, length;
749 int request_tcode;
750
751 request_tcode = HEADER_GET_TCODE(p->header[0]);
752 switch (request_tcode) {
753 case TCODE_WRITE_QUADLET_REQUEST:
754 data = &p->header[3];
755 length = 4;
756 break;
757
758 case TCODE_WRITE_BLOCK_REQUEST:
759 case TCODE_LOCK_REQUEST:
760 data = p->payload;
761 length = HEADER_GET_DATA_LENGTH(p->header[3]);
762 break;
763
764 case TCODE_READ_QUADLET_REQUEST:
765 data = NULL;
766 length = 4;
767 break;
768
769 case TCODE_READ_BLOCK_REQUEST:
770 data = NULL;
771 length = HEADER_GET_DATA_LENGTH(p->header[3]);
772 break;
773
774 default:
775 fw_notice(card, "ERROR - corrupt request received - %08x %08x %08x\n",
776 p->header[0], p->header[1], p->header[2]);
777 return NULL;
778 }
779
> 780 request = kmalloc(struct_size(*request, data, length), GFP_ATOMIC);
781 if (request == NULL)
782 return NULL;
783
784 request->response.speed = p->speed;
785 request->response.timestamp =
786 compute_split_timeout_timestamp(card, p->timestamp);
787 request->response.generation = p->generation;
788 request->response.ack = 0;
789 request->response.callback = free_response_callback;
790 request->ack = p->ack;
791 request->length = length;
792 if (data)
793 memcpy(request->data, data, length);
794
795 memcpy(request->request_header, p->header, sizeof(p->header));
796
797 return request;
798 }
799
---
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] drivers/firewire: use struct_size over open coded arithmetic
Date: Fri, 28 Jan 2022 20:08:57 +0800 [thread overview]
Message-ID: <202201282044.Ye1mhIOd-lkp@intel.com> (raw)
In-Reply-To: <20220128080336.1211525-1-chi.minghao@zte.com.cn>
[-- Attachment #1: Type: text/plain, Size: 7555 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: hexagon-randconfig-r015-20220128 (https://download.01.org/0day-ci/archive/20220128/202201282044.Ye1mhIOd-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
# 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=clang make.cross W=1 O=build_dir ARCH=hexagon SHELL=/bin/bash drivers/firewire/
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 >>):
>> drivers/firewire/core-transaction.c:780:20: error: member reference type 'struct fw_request' is not a pointer; did you mean to use '.'?
request = kmalloc(struct_size(*request, data, length), GFP_ATOMIC);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/overflow.h:326:18: note: expanded from macro 'struct_size'
sizeof(*(p)->member) + __must_be_array((p)->member),\
~~~^
>> drivers/firewire/core-transaction.c:780:20: error: indirection requires pointer operand ('u32[]' (aka 'unsigned int[]') invalid)
request = kmalloc(struct_size(*request, data, length), GFP_ATOMIC);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/overflow.h:326:14: note: expanded from macro 'struct_size'
sizeof(*(p)->member) + __must_be_array((p)->member),\
^~~~~~~~~~~~
>> drivers/firewire/core-transaction.c:780:20: error: member reference type 'struct fw_request' is not a pointer; did you mean to use '.'?
request = kmalloc(struct_size(*request, data, length), GFP_ATOMIC);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/overflow.h:326:49: note: expanded from macro 'struct_size'
sizeof(*(p)->member) + __must_be_array((p)->member),\
~~~~~~~~~~~~~~~~~~~^~~~~~~~~
include/linux/compiler.h:240: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:264: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)); })))
^
>> drivers/firewire/core-transaction.c:780:20: error: member reference type 'struct fw_request' is not a pointer; did you mean to use '.'?
request = kmalloc(struct_size(*request, data, length), GFP_ATOMIC);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/overflow.h:326:49: note: expanded from macro 'struct_size'
sizeof(*(p)->member) + __must_be_array((p)->member),\
~~~~~~~~~~~~~~~~~~~^~~~~~~~~
include/linux/compiler.h:240: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:264: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)); })))
^
>> drivers/firewire/core-transaction.c:780:20: error: indirection requires pointer operand ('struct fw_request' invalid)
request = kmalloc(struct_size(*request, data, length), GFP_ATOMIC);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/overflow.h:327:14: note: expanded from macro 'struct_size'
sizeof(*(p)))
^~~~
5 errors generated.
vim +780 drivers/firewire/core-transaction.c
743
744 static struct fw_request *allocate_request(struct fw_card *card,
745 struct fw_packet *p)
746 {
747 struct fw_request *request;
748 u32 *data, length;
749 int request_tcode;
750
751 request_tcode = HEADER_GET_TCODE(p->header[0]);
752 switch (request_tcode) {
753 case TCODE_WRITE_QUADLET_REQUEST:
754 data = &p->header[3];
755 length = 4;
756 break;
757
758 case TCODE_WRITE_BLOCK_REQUEST:
759 case TCODE_LOCK_REQUEST:
760 data = p->payload;
761 length = HEADER_GET_DATA_LENGTH(p->header[3]);
762 break;
763
764 case TCODE_READ_QUADLET_REQUEST:
765 data = NULL;
766 length = 4;
767 break;
768
769 case TCODE_READ_BLOCK_REQUEST:
770 data = NULL;
771 length = HEADER_GET_DATA_LENGTH(p->header[3]);
772 break;
773
774 default:
775 fw_notice(card, "ERROR - corrupt request received - %08x %08x %08x\n",
776 p->header[0], p->header[1], p->header[2]);
777 return NULL;
778 }
779
> 780 request = kmalloc(struct_size(*request, data, length), GFP_ATOMIC);
781 if (request == NULL)
782 return NULL;
783
784 request->response.speed = p->speed;
785 request->response.timestamp =
786 compute_split_timeout_timestamp(card, p->timestamp);
787 request->response.generation = p->generation;
788 request->response.ack = 0;
789 request->response.callback = free_response_callback;
790 request->ack = p->ack;
791 request->length = length;
792 if (data)
793 memcpy(request->data, data, length);
794
795 memcpy(request->request_header, p->header, sizeof(p->header));
796
797 return request;
798 }
799
---
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:09 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-28 8:03 [PATCH] drivers/firewire: use struct_size over open coded arithmetic cgel.zte
2022-01-28 12:08 ` kernel test robot [this message]
2022-01-28 12:08 ` kernel test robot
2022-01-28 14:54 ` kernel test robot
2022-01-28 14:54 ` 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=202201282044.Ye1mhIOd-lkp@intel.com \
--to=lkp@intel.com \
--cc=cgel.zte@gmail.com \
--cc=chi.minghao@zte.com.cn \
--cc=kbuild-all@lists.01.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux1394-devel@lists.sourceforge.net \
--cc=llvm@lists.linux.dev \
--cc=stefanr@s5r6.in-berlin.de \
--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.