mainline build failure due to df8fc4e934c1 ("kbuild: Enable -fstrict-flex-arrays=3")
From: Sudip Mukherjee (Codethink)
Date: Thu Jun 29 2023 - 09:53:48 EST
Hi All,
The latest mainline kernel branch fails to build with clang (version 16.0.1), and the errors are like:
drivers/scsi/aacraid/commsup.c:1170:17: error: array index 1 is past the end of the array (that has type 'u8[1]' (aka 'unsigned char[1]'), cast to '__le32 *' (aka 'unsigned int *')) [-Werror,-Warray-bounds]
(((__le32 *)aifcmd->data)[1] == cpu_to_le32(3));
^ ~
drivers/scsi/aacraid/aacraid.h:2621:2: note: array 'data' declared here
u8 data[1]; /* Undefined length (from kernel viewpoint) */
^
drivers/scsi/aacraid/commsup.c:1290:20: error: array index 3 is past the end of the array (that has type 'u8[1]' (aka 'unsigned char[1]'), cast to '__le32 *' (aka 'unsigned int *')) [-Werror,-Warray-bounds]
((((__le32 *)aifcmd->data)[3]
^
_______________________________________________________________________
drivers/staging/ks7010/ks_wlan_net.c:1600:34: error: array index 16 is past the end of the array (that has type '__u8[0]' (aka 'unsigned char[0]')) [-Werror,-Warray-bounds]
memcpy(&key->tx_mic_key[0], &enc->key[16], 8);
^ ~~
./include/linux/fortify-string.h:694:35: note: expanded from macro 'memcpy'
__struct_size(p), __struct_size(q), \
^
./include/linux/fortify-string.h:96:56: note: expanded from macro '__struct_size'
#define __struct_size(p) __builtin_dynamic_object_size(p, 0)
^
./include/linux/fortify-string.h:638:27: note: expanded from macro '__fortify_memcpy_chk'
const size_t __q_size = (q_size); \
^~~~~~
./include/uapi/linux/wireless.h:838:2: note: array 'key' declared here
__u8 key[0];
^
_______________________________________________________________________
git bisect pointed to df8fc4e934c1 ("kbuild: Enable -fstrict-flex-arrays=3").
Reverting the commit has fixed the build failure.
I will be happy to test any patch or provide any extra log if needed.
#regzbot introduced: df8fc4e934c12b906d08050d7779f292b9c5c6b5
--
Regards
Sudip