# git rev-parse -q --verify 80d0f1dc412c9195ace153d5351db319d52fb770^{commit} 80d0f1dc412c9195ace153d5351db319d52fb770 already have revision, skipping fetch # git checkout -q -f -B kisskb 80d0f1dc412c9195ace153d5351db319d52fb770 # git clean -qxdf # < git log -1 # commit 80d0f1dc412c9195ace153d5351db319d52fb770 # Author: Gustavo A. R. Silva # Date: Thu May 28 09:35:11 2020 -0500 # # w1: Replace zero-length array with flexible-array # # The current codebase makes use of the zero-length array language # extension to the C90 standard, but the preferred mechanism to declare # variable-length types such as these ones is a flexible array member[1][2], # introduced in C99: # # struct foo { # int stuff; # struct boo array[]; # }; # # By making use of the mechanism above, we will get a compiler warning # in case the flexible array does not occur last in the structure, which # will help us prevent some kind of undefined behavior bugs from being # inadvertently introduced[3] to the codebase from now on. # # Also, notice that, dynamic memory allocations won't be affected by # this change: # # "Flexible array members have incomplete type, and so the sizeof operator # may not be applied. As a quirk of the original implementation of # zero-length arrays, sizeof evaluates to zero."[1] # # sizeof(flexible-array-member) triggers a warning because flexible array # members have incomplete type[1]. There are some instances of code in # which the sizeof operator is being incorrectly/erroneously applied to # zero-length arrays and the result is zero. Such instances may be hiding # some bugs. So, this work (flexible-array member conversions) will also # help to get completely rid of those sorts of issues. # # Notice that, currently, more than 250 of these patches have already # been merged into mainline during the last merge window, including # 5.7-rc2. So, in order to make better use of everyone's time, I'm # planning to add this treewide patch to my -next tree and then send a # pull request to Linus for 5.7-rc3 or -rc4, after getting some acks # and/or reviews. # # This treewide patch has been successfully built (on top of v5.7-rc1) for # multiple architectures (arm, arm64, sparc, powerpc, ia64, s390, i386, # nios2, c6x, xtensa, openrisc, mips, parisc, x86_64, riscv, sh, sparc64) # and 82 different configurations with the help of the 0-day CI guys[5]. # # This issue was found with the help of Coccinelle. # # [1] https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html # [2] https://github.com/KSPP/linux/issues/21 # [3] commit 76497732932f ("cxgb3/l2t: Fix undefined behaviour") # [4] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/log/?qt=grep&q=replace+zero-leng # # Signed-off-by: Gustavo A. R. Silva # < /opt/cross/kisskb/korg/gcc-8.1.0-nolibc/s390-linux/bin/s390-linux-gcc --version # < /opt/cross/kisskb/korg/gcc-8.1.0-nolibc/s390-linux/bin/s390-linux-ld --version # < git log --format=%s --max-count=1 80d0f1dc412c9195ace153d5351db319d52fb770 # < make -s -j 48 ARCH=s390 O=/kisskb/build/gustavoars_s390-allmodconfig_s390x-gcc8 CROSS_COMPILE=/opt/cross/kisskb/korg/gcc-8.1.0-nolibc/s390-linux/bin/s390-linux- allmodconfig # Added to kconfig CONFIG_BUILD_DOCSRC=n # Added to kconfig CONFIG_MODULE_SIG=n # Added to kconfig CONFIG_SAMPLES=n # < make -s -j 48 ARCH=s390 O=/kisskb/build/gustavoars_s390-allmodconfig_s390x-gcc8 CROSS_COMPILE=/opt/cross/kisskb/korg/gcc-8.1.0-nolibc/s390-linux/bin/s390-linux- help # make -s -j 48 ARCH=s390 O=/kisskb/build/gustavoars_s390-allmodconfig_s390x-gcc8 CROSS_COMPILE=/opt/cross/kisskb/korg/gcc-8.1.0-nolibc/s390-linux/bin/s390-linux- olddefconfig # make -s -j 48 ARCH=s390 O=/kisskb/build/gustavoars_s390-allmodconfig_s390x-gcc8 CROSS_COMPILE=/opt/cross/kisskb/korg/gcc-8.1.0-nolibc/s390-linux/bin/s390-linux- /kisskb/src/lib/test_kasan.c: In function 'kasan_alloca_oob_left': /kisskb/src/lib/test_kasan.c:555:1: warning: 'kasan_alloca_oob_left' uses dynamic stack allocation } ^ /kisskb/src/lib/test_kasan.c: In function 'kasan_alloca_oob_right': /kisskb/src/lib/test_kasan.c:565:1: warning: 'kasan_alloca_oob_right' uses dynamic stack allocation } ^ /kisskb/src/drivers/input/joystick/analog.c:160:2: warning: #warning Precise timer not defined for this architecture. [-Wcpp] #warning Precise timer not defined for this architecture. ^~~~~~~ /kisskb/src/drivers/net/ethernet/intel/e1000e/netdev.c:137:13: warning: 'e1000e_check_me' defined but not used [-Wunused-function] static bool e1000e_check_me(u16 device_id) ^~~~~~~~~~~~~~~ /kisskb/src/drivers/scsi/dc395x.c: In function '__dc395x_eh_bus_reset': /kisskb/src/drivers/scsi/dc395x.c:155:36: warning: value computed is not used [-Wunused-value] #define DC395x_read8(acb,address) (u8)(inb(acb->io_port_base + (address))) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /kisskb/src/drivers/scsi/dc395x.c:1197:2: note: in expansion of macro 'DC395x_read8' DC395x_read8(acb, TRM_S1040_SCSI_INTSTATUS); ^~~~~~~~~~~~ /kisskb/src/drivers/scsi/dc395x.c: In function 'set_basic_config': /kisskb/src/drivers/scsi/dc395x.c:155:36: warning: value computed is not used [-Wunused-value] #define DC395x_read8(acb,address) (u8)(inb(acb->io_port_base + (address))) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /kisskb/src/drivers/scsi/dc395x.c:3489:2: note: in expansion of macro 'DC395x_read8' DC395x_read8(acb, TRM_S1040_SCSI_INTSTATUS); ^~~~~~~~~~~~ /kisskb/src/drivers/scsi/dc395x.c: In function 'adapter_uninit_chip': /kisskb/src/drivers/scsi/dc395x.c:155:36: warning: value computed is not used [-Wunused-value] #define DC395x_read8(acb,address) (u8)(inb(acb->io_port_base + (address))) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /kisskb/src/drivers/scsi/dc395x.c:4435:2: note: in expansion of macro 'DC395x_read8' DC395x_read8(acb, TRM_S1040_SCSI_INTSTATUS); ^~~~~~~~~~~~ In file included from /kisskb/src/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c:40: /kisskb/src/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c: In function 'mvpp2_setup_bm_pool': /kisskb/src/drivers/net/ethernet/marvell/mvpp2/mvpp2.h:634:2: warning: overflow in conversion from 'long unsigned int' to 'int' changes value from '18446744073709551584' to '-32' [-Woverflow] ((total_size) - NET_SKB_PAD - MVPP2_SKB_SHINFO_SIZE) ^ /kisskb/src/drivers/net/ethernet/marvell/mvpp2/mvpp2.h:699:33: note: in expansion of macro 'MVPP2_RX_MAX_PKT_SIZE' #define MVPP2_BM_SHORT_PKT_SIZE MVPP2_RX_MAX_PKT_SIZE(MVPP2_BM_SHORT_FRAME_SIZE) ^~~~~~~~~~~~~~~~~~~~~ /kisskb/src/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c:580:41: note: in expansion of macro 'MVPP2_BM_SHORT_PKT_SIZE' mvpp2_pools[MVPP2_BM_SHORT].pkt_size = MVPP2_BM_SHORT_PKT_SIZE; ^~~~~~~~~~~~~~~~~~~~~~~ /kisskb/src/drivers/mailbox/imx-mailbox.c:638:12: warning: 'imx_mu_runtime_resume' defined but not used [-Wunused-function] static int imx_mu_runtime_resume(struct device *dev) ^~~~~~~~~~~~~~~~~~~~~ /kisskb/src/drivers/mailbox/imx-mailbox.c:629:12: warning: 'imx_mu_runtime_suspend' defined but not used [-Wunused-function] static int imx_mu_runtime_suspend(struct device *dev) ^~~~~~~~~~~~~~~~~~~~~~ /kisskb/src/drivers/mailbox/imx-mailbox.c:611:12: warning: 'imx_mu_resume_noirq' defined but not used [-Wunused-function] static int imx_mu_resume_noirq(struct device *dev) ^~~~~~~~~~~~~~~~~~~ /kisskb/src/drivers/mailbox/imx-mailbox.c:601:12: warning: 'imx_mu_suspend_noirq' defined but not used [-Wunused-function] static int imx_mu_suspend_noirq(struct device *dev) ^~~~~~~~~~~~~~~~~~~~ In file included from ./arch/s390/include/generated/asm/cacheflush.h:1, from /kisskb/src/drivers/media/platform/omap3isp/isp.c:42: /kisskb/src/include/asm-generic/cacheflush.h:16:42: warning: 'struct mm_struct' declared inside parameter list will not be visible outside of this definition or declaration static inline void flush_cache_mm(struct mm_struct *mm) ^~~~~~~~~ /kisskb/src/include/asm-generic/cacheflush.h:22:46: warning: 'struct mm_struct' declared inside parameter list will not be visible outside of this definition or declaration static inline void flush_cache_dup_mm(struct mm_struct *mm) ^~~~~~~~~ /kisskb/src/include/asm-generic/cacheflush.h:28:45: warning: 'struct vm_area_struct' declared inside parameter list will not be visible outside of this definition or declaration static inline void flush_cache_range(struct vm_area_struct *vma, ^~~~~~~~~~~~~~ /kisskb/src/include/asm-generic/cacheflush.h:36:44: warning: 'struct vm_area_struct' declared inside parameter list will not be visible outside of this definition or declaration static inline void flush_cache_page(struct vm_area_struct *vma, ^~~~~~~~~~~~~~ /kisskb/src/include/asm-generic/cacheflush.h:44:45: warning: 'struct page' declared inside parameter list will not be visible outside of this definition or declaration static inline void flush_dcache_page(struct page *page) ^~~~ /kisskb/src/include/asm-generic/cacheflush.h:52:50: warning: 'struct address_space' declared inside parameter list will not be visible outside of this definition or declaration static inline void flush_dcache_mmap_lock(struct address_space *mapping) ^~~~~~~~~~~~~ /kisskb/src/include/asm-generic/cacheflush.h:58:52: warning: 'struct address_space' declared inside parameter list will not be visible outside of this definition or declaration static inline void flush_dcache_mmap_unlock(struct address_space *mapping) ^~~~~~~~~~~~~ /kisskb/src/include/asm-generic/cacheflush.h:75:17: warning: 'struct page' declared inside parameter list will not be visible outside of this definition or declaration struct page *page) ^~~~ /kisskb/src/include/asm-generic/cacheflush.h:74:45: warning: 'struct vm_area_struct' declared inside parameter list will not be visible outside of this definition or declaration static inline void flush_icache_page(struct vm_area_struct *vma, ^~~~~~~~~~~~~~ /kisskb/src/include/asm-generic/cacheflush.h:82:16: warning: 'struct page' declared inside parameter list will not be visible outside of this definition or declaration struct page *page, ^~~~ /kisskb/src/include/asm-generic/cacheflush.h:81:50: warning: 'struct vm_area_struct' declared inside parameter list will not be visible outside of this definition or declaration static inline void flush_icache_user_page(struct vm_area_struct *vma, ^~~~~~~~~~~~~~ Completed OK # rm -rf /kisskb/build/gustavoars_s390-allmodconfig_s390x-gcc8 # Build took: 0:19:20.046424