linux/fs/f2fs
Gustavo A. R. Silva 50b1203d8c f2fs: xattr.h: Replace zero-length array with flexible-array member
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]

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 7649773293 ("cxgb3/l2t: Fix undefined behaviour")

Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2020-03-22 21:16:29 -07:00
..
acl.c f2fs: Replace spaces with tab 2019-05-08 21:23:11 -07:00
acl.h f2fs: add SPDX license identifiers 2018-09-12 13:07:10 -07:00
checkpoint.c f2fs: Add a new CP flag to help fsck fix resize SPO issues 2020-03-22 21:16:28 -07:00
compress.c f2fs: fix to avoid triggering IO in write path 2020-03-19 11:41:26 -07:00
data.c f2fs: avoid __GFP_NOFAIL in f2fs_bio_alloc 2020-03-19 11:41:26 -07:00
debug.c f2fs: show mounted time 2020-03-19 11:41:25 -07:00
dir.c f2fs-for-5.6 2020-01-30 15:39:24 -08:00
extent_cache.c f2fs: introduce f2fs_<level> macros to wrap f2fs_printk() 2019-07-02 15:40:40 -07:00
f2fs.h f2fs: use kmem_cache pool during inline xattr lookups 2020-03-22 21:16:27 -07:00
file.c f2fs: fix to show tracepoint correctly 2020-03-19 11:41:26 -07:00
gc.c f2fs: fix to update f2fs_super_block fields under sb_lock 2020-03-22 21:16:29 -07:00
gc.h f2fs: add SPDX license identifiers 2018-09-12 13:07:10 -07:00
hash.c f2fs: Support case-insensitive file name lookups 2019-08-23 07:57:13 -07:00
inline.c f2fs: convert inline_dir early before starting rename 2020-01-17 16:48:42 -08:00
inode.c f2fs: introduce DEFAULT_IO_TIMEOUT 2020-03-19 11:41:26 -07:00
Kconfig f2fs-for-5.6 2020-01-30 15:39:24 -08:00
Makefile f2fs: support data compression 2020-01-17 16:48:07 -08:00
namei.c f2fs: fix inconsistent comments 2020-03-10 09:18:33 -07:00
node.c f2fs: add prefix for f2fs slab cache name 2020-03-19 11:41:26 -07:00
node.h f2fs: check PageWriteback flag for ordered case 2018-12-26 15:16:56 -08:00
recovery.c f2fs: introduce DEFAULT_IO_TIMEOUT 2020-03-19 11:41:26 -07:00
segment.c f2fs: add prefix for f2fs slab cache name 2020-03-19 11:41:26 -07:00
segment.h f2fs: show mounted time 2020-03-19 11:41:25 -07:00
shrinker.c f2fs: fix inconsistent comments 2020-03-10 09:18:33 -07:00
super.c f2fs: use kmem_cache pool during inline xattr lookups 2020-03-22 21:16:27 -07:00
sysfs.c f2fs: show mounted time 2020-03-19 11:41:25 -07:00
trace.c f2fs: do not use mutex lock in atomic context 2019-03-05 19:58:06 -08:00
trace.h f2fs: add SPDX license identifiers 2018-09-12 13:07:10 -07:00
verity.c fs-verity: implement readahead of Merkle tree pages 2020-01-14 13:27:32 -08:00
xattr.c f2fs: use kmem_cache pool during inline xattr lookups 2020-03-22 21:16:27 -07:00
xattr.h f2fs: xattr.h: Replace zero-length array with flexible-array member 2020-03-22 21:16:29 -07:00