# git rev-parse -q --verify d5f6545934c47e97c0b48a645418e877b452a992^{commit} d5f6545934c47e97c0b48a645418e877b452a992 already have revision, skipping fetch # git checkout -q -f -B kisskb d5f6545934c47e97c0b48a645418e877b452a992 # git clean -qxdf # < git log -1 # commit d5f6545934c47e97c0b48a645418e877b452a992 # Author: Linus Torvalds # Date: Mon Sep 20 10:26:21 2021 -0700 # # qnx4: work around gcc false positive warning bug # # In commit b7213ffa0e58 ("qnx4: avoid stringop-overread errors") I tried # to teach gcc about how the directory entry structure can be two # different things depending on a status flag. It made the code clearer, # and it seemed to make gcc happy. # # However, Arnd points to a gcc bug, where despite using two different # members of a union, gcc then gets confused, and uses the size of one of # the members to decide if a string overrun happens. And not necessarily # the rigth one. # # End result: with some configurations, gcc-11 will still complain about # the source buffer size being overread: # # fs/qnx4/dir.c: In function 'qnx4_readdir': # fs/qnx4/dir.c:76:32: error: 'strnlen' specified bound [16, 48] exceeds source size 1 [-Werror=stringop-overread] # 76 | size = strnlen(name, size); # | ^~~~~~~~~~~~~~~~~~~ # fs/qnx4/dir.c:26:22: note: source object declared here # 26 | char de_name; # | ^~~~~~~ # # because gcc will get confused about which union member entry is actually # getting accessed, even when the source code is very clear about it. Gcc # internally will have combined two "redundant" pointers (pointing to # different union elements that are at the same offset), and takes the # size checking from one or the other - not necessarily the right one. # # This is clearly a gcc bug, but we can work around it fairly easily. The # biggest thing here is the big honking comment about why we do what we # do. # # Link: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99578#c6 # Reported-and-tested-by: Arnd Bergmann # Signed-off-by: Linus Torvalds # < /opt/cross/kisskb/korg/gcc-11.1.0-nolibc/m68k-linux/bin/m68k-linux-gcc --version # < /opt/cross/kisskb/korg/gcc-11.1.0-nolibc/m68k-linux/bin/m68k-linux-ld --version # < git log --format=%s --max-count=1 d5f6545934c47e97c0b48a645418e877b452a992 # < make -s -j 8 ARCH=m68k O=/kisskb/build/linus_m5272c3_defconfig_m68k-gcc11 CROSS_COMPILE=/opt/cross/kisskb/korg/gcc-11.1.0-nolibc/m68k-linux/bin/m68k-linux- m5272c3_defconfig # < make -s -j 8 ARCH=m68k O=/kisskb/build/linus_m5272c3_defconfig_m68k-gcc11 CROSS_COMPILE=/opt/cross/kisskb/korg/gcc-11.1.0-nolibc/m68k-linux/bin/m68k-linux- help # make -s -j 8 ARCH=m68k O=/kisskb/build/linus_m5272c3_defconfig_m68k-gcc11 CROSS_COMPILE=/opt/cross/kisskb/korg/gcc-11.1.0-nolibc/m68k-linux/bin/m68k-linux- olddefconfig # make -s -j 8 ARCH=m68k O=/kisskb/build/linus_m5272c3_defconfig_m68k-gcc11 CROSS_COMPILE=/opt/cross/kisskb/korg/gcc-11.1.0-nolibc/m68k-linux/bin/m68k-linux- In file included from /kisskb/src/include/linux/string.h:20, from /kisskb/src/include/linux/bitmap.h:10, from /kisskb/src/include/linux/cpumask.h:12, from /kisskb/src/include/linux/mm_types_task.h:14, from /kisskb/src/include/linux/mm_types.h:5, from /kisskb/src/include/linux/buildid.h:5, from /kisskb/src/include/linux/module.h:14, from /kisskb/src/drivers/net/ethernet/freescale/fec_main.c:25: In function 'fec_get_mac', inlined from 'fec_enet_init' at /kisskb/src/drivers/net/ethernet/freescale/fec_main.c:3510:8, inlined from 'fec_probe' at /kisskb/src/drivers/net/ethernet/freescale/fec_main.c:3932:8: /kisskb/src/arch/m68k/include/asm/string.h:72:25: warning: '__builtin_memcpy' reading 6 bytes from a region of size 0 [-Wstringop-overread] 72 | #define memcpy(d, s, n) __builtin_memcpy(d, s, n) | ^~~~~~~~~~~~~~~~~~~~~~~~~ /kisskb/src/drivers/net/ethernet/freescale/fec_main.c:1771:9: note: in expansion of macro 'memcpy' 1771 | memcpy(ndev->dev_addr, iap, ETH_ALEN); | ^~~~~~ Completed OK # rm -rf /kisskb/build/linus_m5272c3_defconfig_m68k-gcc11 # Build took: 0:00:54.368353