treewide: uapi: Replace zero-length arrays with flexible-array membersThere is a regular need in the kernel to provide a way to declarehaving a dynamically sized set of trailing elements in a stru
treewide: uapi: Replace zero-length arrays with flexible-array membersThere is a regular need in the kernel to provide a way to declarehaving a dynamically sized set of trailing elements in a structure.Kernel code should always use “flexible array members”[1] for thesecases. The older style of one-element or zero-length arrays shouldno longer be used[2].This code was transformed with the help of Coccinelle:(linux-5.19-rc2$ spatch --jobs $(getconf _NPROCESSORS_ONLN) --sp-file script.cocci --include-headers --dir . > output.patch)@@identifier S, member, array;type T1, T2;@@struct S { ... T1 member; T2 array[- 0 ];};-fstrict-flex-arrays=3 is coming and we need to land these changesto prevent issues like these in the short future:../fs/minix/dir.c:337:3: warning: 'strcpy' will always overflow; destination buffer has size 0,but the source string has length 2 (including NUL byte) [-Wfortify-source] strcpy(de3->name, "."); ^Since these are all [0] to [] changes, the risk to UAPI is nearly zero. Ifthis breaks anything, we can use a union with a new member name.[1] https://en.wikipedia.org/wiki/Flexible_array_member[2] https://www.kernel.org/doc/html/v5.16/process/deprecated.html#zero-length-and-one-element-arraysLink: https://github.com/KSPP/linux/issues/78Build-tested-by: kernel test robot <lkp@intel.com>Link: https://lore.kernel.org/lkml/62b675ec.wKX6AOZ6cbE71vtF%25lkp@intel.com/Acked-by: Dan Williams <dan.j.williams@intel.com> # For ndctl.hSigned-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
show more ...
net, uapi: fix -Wpointer-arith warningsAdd casts to fix these warnings:./usr/include/linux/netfilter_arp/arp_tables.h:200:19: error: pointer of type 'void *' used in arithmetic [-Werror=pointer-a
net, uapi: fix -Wpointer-arith warningsAdd casts to fix these warnings:./usr/include/linux/netfilter_arp/arp_tables.h:200:19: error: pointer of type 'void *' used in arithmetic [-Werror=pointer-arith]./usr/include/linux/netfilter_bridge/ebtables.h:197:19: error: pointer of type 'void *' used in arithmetic [-Werror=pointer-arith]./usr/include/linux/netfilter_ipv4/ip_tables.h:223:19: error: pointer of type 'void *' used in arithmetic [-Werror=pointer-arith]./usr/include/linux/netfilter_ipv6/ip6_tables.h:263:19: error: pointer of type 'void *' used in arithmetic [-Werror=pointer-arith]./usr/include/linux/tipc_config.h:310:28: error: pointer of type 'void *' used in arithmetic [-Werror=pointer-arith]./usr/include/linux/tipc_config.h:410:24: error: pointer of type 'void *' used in arithmetic [-Werror=pointer-arith]./usr/include/linux/virtio_ring.h:170:16: error: pointer of type 'void *' used in arithmetic [-Werror=pointer-arith]Those are theoretical probably but kernel doesn't control compiler flagsin userspace.Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>Signed-off-by: David S. Miller <davem@davemloft.net>
License cleanup: add SPDX license identifier to uapi header files with no licenseMany user space API headers are missing licensing information, whichmakes it hard for compliance tools to determine
License cleanup: add SPDX license identifier to uapi header files with no licenseMany user space API headers are missing licensing information, whichmakes it hard for compliance tools to determine the correct license.By default are files without license information under the defaultlicense of the kernel, which is GPLV2. Marking them GPLV2 would excludethem from being included in non GPLV2 code, which is obviously notintended. The user space API headers fall under the syscall exceptionwhich is in the kernels COPYING file: NOTE! This copyright does *not* cover user programs that use kernel services by normal system calls - this is merely considered normal use of the kernel, and does *not* fall under the heading of "derived work".otherwise syscall usage would not be possible.Update the files which contain no license information with an SPDXlicense identifier. The chosen identifier is 'GPL-2.0 WITHLinux-syscall-note' which is the officially assigned identifier for theLinux syscall exception. SPDX license identifiers are a legally bindingshorthand, which can be used instead of the full boiler plate text.This patch is based on work done by Thomas Gleixner and Kate Stewart andPhilippe Ombredanne. See the previous patch in this series for themethodology of how this patch was researched.Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org>Reviewed-by: Philippe Ombredanne <pombredanne@nexb.com>Reviewed-by: Thomas Gleixner <tglx@linutronix.de>Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
uapi: export all headers under uapi directoriesRegularly, when a new header is created in include/uapi/, the developerforgets to add it in the corresponding Kbuild file. This error is usuallydete
uapi: export all headers under uapi directoriesRegularly, when a new header is created in include/uapi/, the developerforgets to add it in the corresponding Kbuild file. This error is usuallydetected after the release is out.In fact, all headers under uapi directories should be exported, thus it'suseless to have an exhaustive list.After this patch, the following files, which were not exported, are nowexported (with make headers_install_all):asm-arc/kvm_para.hasm-arc/ucontext.hasm-blackfin/shmparam.hasm-blackfin/ucontext.hasm-c6x/shmparam.hasm-c6x/ucontext.hasm-cris/kvm_para.hasm-h8300/shmparam.hasm-h8300/ucontext.hasm-hexagon/shmparam.hasm-m32r/kvm_para.hasm-m68k/kvm_para.hasm-m68k/shmparam.hasm-metag/kvm_para.hasm-metag/shmparam.hasm-metag/ucontext.hasm-mips/hwcap.hasm-mips/reg.hasm-mips/ucontext.hasm-nios2/kvm_para.hasm-nios2/ucontext.hasm-openrisc/shmparam.hasm-parisc/kvm_para.hasm-powerpc/perf_regs.hasm-sh/kvm_para.hasm-sh/ucontext.hasm-tile/shmparam.hasm-unicore32/shmparam.hasm-unicore32/ucontext.hasm-x86/hwcap2.hasm-xtensa/kvm_para.hdrm/armada_drm.hdrm/etnaviv_drm.hdrm/vgem_drm.hlinux/aspeed-lpc-ctrl.hlinux/auto_dev-ioctl.hlinux/bcache.hlinux/btrfs_tree.hlinux/can/vxcan.hlinux/cifs/cifs_mount.hlinux/coresight-stm.hlinux/cryptouser.hlinux/fsmap.hlinux/genwqe/genwqe_card.hlinux/hash_info.hlinux/kcm.hlinux/kcov.hlinux/kfd_ioctl.hlinux/lightnvm.hlinux/module.hlinux/nbd-netlink.hlinux/nilfs2_api.hlinux/nilfs2_ondisk.hlinux/nsfs.hlinux/pr.hlinux/qrtr.hlinux/rpmsg.hlinux/sched/types.hlinux/sed-opal.hlinux/smc.hlinux/smc_diag.hlinux/stm.hlinux/switchtec_ioctl.hlinux/vfio_ccw.hlinux/wil6210_uapi.hrdma/bnxt_re-abi.hNote that I have removed from this list the files which are generated in everyexported directories (like .install or .install.cmd).Thanks to Julien Floret <julien.floret@6wind.com> for the tip to get allsubdirs with a pure makefile command.For the record, note that exported files for asm directories are a mix offiles listed by: - include/uapi/asm-generic/Kbuild.asm; - arch/<arch>/include/uapi/asm/Kbuild; - arch/<arch>/include/asm/Kbuild.Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>Acked-by: Russell King <rmk+kernel@armlinux.org.uk>Acked-by: Mark Salter <msalter@redhat.com>Acked-by: Michael Ellerman <mpe@ellerman.id.au> (powerpc)Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
netfilter: fix include files for compilationAdd missing header dependencies and other small changes so that each filecompiles alone in userspace.Signed-off-by: Mikko Rapeli <mikko.rapeli@iki.fi>
netfilter: fix include files for compilationAdd missing header dependencies and other small changes so that each filecompiles alone in userspace.Signed-off-by: Mikko Rapeli <mikko.rapeli@iki.fi>Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
uapi: netfilter_arp: use __u8 instead of u_int8_tSimilarly, the u_int8_t type is non-standard and not defined. Changeit to use __u8 like the rest of the netfilter headers.Signed-off-by: Mike Fr
uapi: netfilter_arp: use __u8 instead of u_int8_tSimilarly, the u_int8_t type is non-standard and not defined. Changeit to use __u8 like the rest of the netfilter headers.Signed-off-by: Mike Frysinger <vapier@gentoo.org>Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
UAPI: (Scripted) Disintegrate include/linux/netfilter_arpSigned-off-by: David Howells <dhowells@redhat.com>Acked-by: Arnd Bergmann <arnd@arndb.de>Acked-by: Thomas Gleixner <tglx@linutronix.de>Ac
UAPI: (Scripted) Disintegrate include/linux/netfilter_arpSigned-off-by: David Howells <dhowells@redhat.com>Acked-by: Arnd Bergmann <arnd@arndb.de>Acked-by: Thomas Gleixner <tglx@linutronix.de>Acked-by: Michael Kerrisk <mtk.manpages@gmail.com>Acked-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>Acked-by: Dave Jones <davej@redhat.com>
UAPI: (Scripted) Set up UAPI Kbuild filesSet up empty UAPI Kbuild files to be populated by the header splitter.Signed-off-by: David Howells <dhowells@redhat.com>Acked-by: Arnd Bergmann <arnd@arn
UAPI: (Scripted) Set up UAPI Kbuild filesSet up empty UAPI Kbuild files to be populated by the header splitter.Signed-off-by: David Howells <dhowells@redhat.com>Acked-by: Arnd Bergmann <arnd@arndb.de>Acked-by: Thomas Gleixner <tglx@linutronix.de>Acked-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>Acked-by: Dave Jones <davej@redhat.com>