https://github.com/torvalds/linux
Revision 13402837414070492004cd0a9c80b5fcebbd1a9e authored by Linus Torvalds on 19 April 2020, 17:34:30 UTC, committed by Linus Torvalds on 19 April 2020, 17:34:30 UTC
Pull flexible-array member conversion from Gustavo Silva: "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 convertions) will also help to get completely rid of those sorts of issues. Notice that all of these patches have been baking in linux-next for quite a while now and, 238 more of these patches have already been merged into 5.7-rc1. There are a couple hundred more of these issues waiting to be addressed in the whole codebase" [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") * tag 'flexible-array-member-5.7-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/gustavoars/linux: (28 commits) xattr.h: Replace zero-length array with flexible-array member uapi: linux: fiemap.h: Replace zero-length array with flexible-array member uapi: linux: dlm_device.h: Replace zero-length array with flexible-array member tpm_eventlog.h: Replace zero-length array with flexible-array member ti_wilink_st.h: Replace zero-length array with flexible-array member swap.h: Replace zero-length array with flexible-array member skbuff.h: Replace zero-length array with flexible-array member sched: topology.h: Replace zero-length array with flexible-array member rslib.h: Replace zero-length array with flexible-array member rio.h: Replace zero-length array with flexible-array member posix_acl.h: Replace zero-length array with flexible-array member platform_data: wilco-ec.h: Replace zero-length array with flexible-array member memcontrol.h: Replace zero-length array with flexible-array member list_lru.h: Replace zero-length array with flexible-array member lib: cpu_rmap: Replace zero-length array with flexible-array member irq.h: Replace zero-length array with flexible-array member ihex.h: Replace zero-length array with flexible-array member igmp.h: Replace zero-length array with flexible-array member genalloc.h: Replace zero-length array with flexible-array member ethtool.h: Replace zero-length array with flexible-array member ...
Tip revision: 13402837414070492004cd0a9c80b5fcebbd1a9e authored by Linus Torvalds on 19 April 2020, 17:34:30 UTC
Merge tag 'flexible-array-member-5.7-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/gustavoars/linux
Merge tag 'flexible-array-member-5.7-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/gustavoars/linux
Tip revision: 1340283
File | Mode | Size |
---|---|---|
9p | ||
adfs | ||
affs | ||
afs | ||
autofs | ||
befs | ||
bfs | ||
btrfs | ||
cachefiles | ||
ceph | ||
cifs | ||
coda | ||
configfs | ||
cramfs | ||
crypto | ||
debugfs | ||
devpts | ||
dlm | ||
ecryptfs | ||
efivarfs | ||
efs | ||
erofs | ||
exfat | ||
exportfs | ||
ext2 | ||
ext4 | ||
f2fs | ||
fat | ||
freevxfs | ||
fscache | ||
fuse | ||
gfs2 | ||
hfs | ||
hfsplus | ||
hostfs | ||
hpfs | ||
hugetlbfs | ||
iomap | ||
isofs | ||
jbd2 | ||
jffs2 | ||
jfs | ||
kernfs | ||
lockd | ||
minix | ||
nfs | ||
nfs_common | ||
nfsd | ||
nilfs2 | ||
nls | ||
notify | ||
ntfs | ||
ocfs2 | ||
omfs | ||
openpromfs | ||
orangefs | ||
overlayfs | ||
proc | ||
pstore | ||
qnx4 | ||
qnx6 | ||
quota | ||
ramfs | ||
reiserfs | ||
romfs | ||
squashfs | ||
sysfs | ||
sysv | ||
tracefs | ||
ubifs | ||
udf | ||
ufs | ||
unicode | ||
vboxsf | ||
verity | ||
xfs | ||
zonefs | ||
Kconfig | -rw-r--r-- | 7.7 KB |
Kconfig.binfmt | -rw-r--r-- | 7.6 KB |
Makefile | -rw-r--r-- | 4.5 KB |
aio.c | -rw-r--r-- | 56.4 KB |
anon_inodes.c | -rw-r--r-- | 4.6 KB |
attr.c | -rw-r--r-- | 9.7 KB |
bad_inode.c | -rw-r--r-- | 5.3 KB |
binfmt_aout.c | -rw-r--r-- | 8.3 KB |
binfmt_elf.c | -rw-r--r-- | 62.8 KB |
binfmt_elf_fdpic.c | -rw-r--r-- | 47.2 KB |
binfmt_em86.c | -rw-r--r-- | 2.8 KB |
binfmt_flat.c | -rw-r--r-- | 28.0 KB |
binfmt_misc.c | -rw-r--r-- | 18.5 KB |
binfmt_script.c | -rw-r--r-- | 4.4 KB |
block_dev.c | -rw-r--r-- | 57.1 KB |
buffer.c | -rw-r--r-- | 89.3 KB |
char_dev.c | -rw-r--r-- | 16.5 KB |
compat.c | -rw-r--r-- | 3.2 KB |
compat_binfmt_elf.c | -rw-r--r-- | 3.3 KB |
coredump.c | -rw-r--r-- | 22.1 KB |
d_path.c | -rw-r--r-- | 11.3 KB |
dax.c | -rw-r--r-- | 45.7 KB |
dcache.c | -rw-r--r-- | 84.0 KB |
dcookies.c | -rw-r--r-- | 7.1 KB |
direct-io.c | -rw-r--r-- | 40.1 KB |
drop_caches.c | -rw-r--r-- | 1.8 KB |
eventfd.c | -rw-r--r-- | 11.6 KB |
eventpoll.c | -rw-r--r-- | 65.3 KB |
exec.c | -rw-r--r-- | 48.2 KB |
fcntl.c | -rw-r--r-- | 23.3 KB |
fhandle.c | -rw-r--r-- | 6.8 KB |
file.c | -rw-r--r-- | 24.7 KB |
file_table.c | -rw-r--r-- | 10.2 KB |
filesystems.c | -rw-r--r-- | 6.4 KB |
fs-writeback.c | -rw-r--r-- | 74.6 KB |
fs_context.c | -rw-r--r-- | 17.7 KB |
fs_parser.c | -rw-r--r-- | 10.1 KB |
fs_pin.c | -rw-r--r-- | 1.9 KB |
fs_struct.c | -rw-r--r-- | 3.3 KB |
fs_types.c | -rw-r--r-- | 2.5 KB |
fsopen.c | -rw-r--r-- | 11.0 KB |
inode.c | -rw-r--r-- | 60.4 KB |
internal.h | -rw-r--r-- | 5.0 KB |
io-wq.c | -rw-r--r-- | 26.9 KB |
io-wq.h | -rw-r--r-- | 3.7 KB |
io_uring.c | -rw-r--r-- | 190.7 KB |
ioctl.c | -rw-r--r-- | 21.3 KB |
libfs.c | -rw-r--r-- | 34.7 KB |
locks.c | -rw-r--r-- | 79.7 KB |
mbcache.c | -rw-r--r-- | 12.0 KB |
mount.h | -rw-r--r-- | 4.0 KB |
mpage.c | -rw-r--r-- | 21.1 KB |
namei.c | -rw-r--r-- | 119.6 KB |
namespace.c | -rw-r--r-- | 96.8 KB |
no-block.c | -rw-r--r-- | 478 bytes |
nsfs.c | -rw-r--r-- | 6.5 KB |
open.c | -rw-r--r-- | 32.2 KB |
pipe.c | -rw-r--r-- | 32.6 KB |
pnode.c | -rw-r--r-- | 15.1 KB |
pnode.h | -rw-r--r-- | 1.9 KB |
posix_acl.c | -rw-r--r-- | 21.5 KB |
proc_namespace.c | -rw-r--r-- | 7.8 KB |
read_write.c | -rw-r--r-- | 52.7 KB |
readdir.c | -rw-r--r-- | 13.6 KB |
select.c | -rw-r--r-- | 34.3 KB |
seq_file.c | -rw-r--r-- | 23.9 KB |
signalfd.c | -rw-r--r-- | 9.0 KB |
splice.c | -rw-r--r-- | 41.1 KB |
stack.c | -rw-r--r-- | 2.5 KB |
stat.c | -rw-r--r-- | 19.6 KB |
statfs.c | -rw-r--r-- | 9.6 KB |
super.c | -rw-r--r-- | 48.0 KB |
sync.c | -rw-r--r-- | 10.4 KB |
timerfd.c | -rw-r--r-- | 13.6 KB |
userfaultfd.c | -rw-r--r-- | 52.7 KB |
utimes.c | -rw-r--r-- | 7.3 KB |
xattr.c | -rw-r--r-- | 23.7 KB |
Computing file changes ...