linux/fs/nfs
Gustavo A. R. Silva 5601cda82b nfs: 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>
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
2020-03-16 10:16:26 -04:00
..
blocklayout NFSv4: Ensure layout headers are RCU safe 2020-03-16 08:34:29 -04:00
filelayout NFSv4: Ensure layout headers are RCU safe 2020-03-16 08:34:29 -04:00
flexfilelayout NFSv4: Ensure layout headers are RCU safe 2020-03-16 08:34:29 -04:00
cache_lib.c NFS client updates for Linux 4.15 2017-11-17 14:18:00 -08:00
cache_lib.h NFS client updates for Linux 4.15 2017-11-17 14:18:00 -08:00
callback_proc.c NFSv4: Add support for CB_RECALL_ANY for flexfiles layouts 2020-03-16 08:34:30 -04:00
callback_xdr.c NFS4: Report callback authentication errors 2020-01-15 10:54:31 -05:00
callback.c SUNRPC: Cache the process user cred in the RPC server listener 2019-04-24 09:46:35 -04:00
callback.h NFSv4: Add support for CB_RECALL_ANY for flexfiles layouts 2020-03-16 08:34:30 -04:00
client.c nfs: add minor version to nfs_server_key for fscache 2020-02-25 13:53:24 -05:00
delegation.c NFSv4: Clean up nfs_delegation_reap_expired() 2020-03-16 08:34:30 -04:00
delegation.h NFSv4: Ensure the delegation is pinned in nfs_do_return_delegation() 2020-02-13 16:18:50 -05:00
dir.c nfs: Replace zero-length array with flexible-array member 2020-03-16 10:16:26 -04:00
direct.c NFS: Fix nfs_direct_write_reschedule_io() 2020-01-15 10:54:33 -05:00
dns_resolve.c NFS: Replace various occurrences of kstrndup() with kmemdup_nul() 2020-02-03 16:35:07 -05:00
dns_resolve.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
export.c NFS: Add a tracepoint in nfs_fh_to_dentry() 2019-11-03 21:28:46 -05:00
file.c NFS: Fix up fsync() when the server rebooted 2020-01-15 10:54:32 -05:00
fs_context.c NFS: Fix leak of ctx->nfs_server.hostname 2020-02-25 13:48:21 -05:00
fscache-index.c nfs: fscache: use timespec64 in inode auxdata 2020-01-15 10:54:30 -05:00
fscache.c nfs: add minor version to nfs_server_key for fscache 2020-02-25 13:53:24 -05:00
fscache.h nfs: fscache: use timespec64 in inode auxdata 2020-01-15 10:54:30 -05:00
getroot.c NFS: Attach supplementary error information to fs_context. 2020-01-15 10:15:17 -05:00
inode.c NFS: alloc_nfs_open_context() must use the file cred when available 2020-03-16 08:34:28 -04:00
internal.h NFS: Add a helper nfs_client_for_each_server() 2020-03-16 08:34:30 -04:00
io.c NFS: Fix up documentation warnings 2019-02-20 15:14:21 -05:00
iostat.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
Kconfig NFS: allow deprecation of NFS UDP protocol 2020-01-24 16:51:13 -05:00
Makefile NFS: Move mount parameterisation bits into their own file 2020-01-15 10:15:17 -05:00
mount_clnt.c NFS: remove unused macros 2020-02-03 10:43:06 -05:00
namespace.c NFS: Don't hard-code the fs_type when submounting 2020-02-25 13:31:19 -05:00
netns.h NFS: Add sysfs support for per-container identifier 2019-07-06 14:54:49 -04:00
nfs.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
nfs2super.c treewide: Add SPDX license identifier for more missed files 2019-05-21 10:50:45 +02:00
nfs2xdr.c nfs: remove timespec from xdr_encode_nfstime 2020-01-15 10:54:30 -05:00
nfs3_fs.h NFS: Additional refactoring for fs_context conversion 2020-01-15 10:15:17 -05:00
nfs3acl.c nfs: fix xfstest generic/099 failed on nfsv3 2019-02-20 17:33:55 -05:00
nfs3client.c NFS: Additional refactoring for fs_context conversion 2020-01-15 10:15:17 -05:00
nfs3proc.c NFS: Add softreval behaviour to nfs_lookup_revalidate() 2020-01-24 16:51:13 -05:00
nfs3super.c treewide: Add SPDX license identifier for more missed files 2019-05-21 10:50:45 +02:00
nfs3xdr.c NFS/pnfs: Fix pnfs_generic_prepare_to_resend_writes() 2020-01-15 10:54:32 -05:00
nfs4_fs.h NFSv4: Add support for CB_RECALL_ANY for flexfiles layouts 2020-03-16 08:34:30 -04:00
nfs4client.c nfs: add minor version to nfs_server_key for fscache 2020-02-25 13:53:24 -05:00
nfs4file.c NFSv4.2: error out when relink swapfile 2020-03-16 10:14:30 -04:00
nfs4getroot.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
nfs4idmap.c Revert "Merge tag 'keys-acl-20190703' of git://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs" 2019-07-10 18:43:43 -07:00
nfs4idmap.h
nfs4namespace.c NFS: Replace various occurrences of kstrndup() with kmemdup_nul() 2020-02-03 16:35:07 -05:00
nfs4proc.c nfs: Replace zero-length array with flexible-array member 2020-03-16 10:16:26 -04:00
nfs4renewd.c NFSv4.0: nfs4_do_fsinfo() should not do implicit lease renewals 2020-02-04 12:27:55 -05:00
nfs4session.c treewide: Add SPDX license identifier for missed files 2019-05-21 10:50:45 +02:00
nfs4session.h NFSv4.1: Bump the default callback session slot count to 16 2019-03-02 16:25:26 -05:00
nfs4state.c NFSv4: Add support for CB_RECALL_ANY for flexfiles layouts 2020-03-16 08:34:30 -04:00
nfs4super.c NFS: Attach supplementary error information to fs_context. 2020-01-15 10:15:17 -05:00
nfs4sysctl.c nfs: Do not convert nfs_idmap_cache_timeout to jiffies 2018-01-18 15:10:47 -05:00
nfs4trace.c pNFS/flexfiles: Add tracing for layout errors 2020-01-15 10:54:33 -05:00
nfs4trace.h NFSv4: Add support for CB_RECALL_ANY for flexfiles layouts 2020-03-16 08:34:30 -04:00
nfs4xdr.c NFS/pnfs: Fix pnfs_generic_prepare_to_resend_writes() 2020-01-15 10:54:32 -05:00
nfs42.h NFS based on file size issue sync copy or fallback to generic copy offload 2019-10-09 12:06:22 -04:00
nfs42proc.c NFS: Fix memory leaks 2020-02-04 11:01:54 -05:00
nfs42xdr.c NFS: add ca_source_server<> to COPY 2019-10-09 12:05:49 -04:00
nfsroot.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
nfstrace.c NFS: Add trace events to report non-zero NFS status codes 2019-02-13 12:03:21 -05:00
nfstrace.h NFS Client Updates for Linux 5.6 2020-02-07 17:39:56 -08:00
pagelist.c NFS: Assume cred is pinned by open context in I/O requests 2020-03-16 08:34:29 -04:00
pnfs_dev.c NFS/flexfiles: Speed up read failover when DSes are down 2019-03-01 22:37:38 -05:00
pnfs_nfs.c NFS/pnfs: Fix pnfs_generic_prepare_to_resend_writes() 2020-01-15 10:54:32 -05:00
pnfs.c NFSv4: Add support for CB_RECALL_ANY for flexfiles layouts 2020-03-16 08:34:30 -04:00
pnfs.h NFSv4: Add support for CB_RECALL_ANY for flexfiles layouts 2020-03-16 08:34:30 -04:00
proc.c NFS: Add softreval behaviour to nfs_lookup_revalidate() 2020-01-24 16:51:13 -05:00
read.c NFS: When resending after a short write, reset the reply count to zero 2020-01-15 10:54:33 -05:00
super.c NFS: Add a helper nfs_client_for_each_server() 2020-03-16 08:34:30 -04:00
symlink.c nfs: pass the correct prototype to read_cache_page 2019-05-09 16:26:57 -04:00
sysctl.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
sysfs.c fs: nfs: sysfs: Remove NULL check before kfree 2019-11-18 10:38:04 +01:00
sysfs.h NFS: Add sysfs support for per-container identifier 2019-07-06 14:54:49 -04:00
unlink.c NFS: Avoid referencing the cred twice in async rename/unlink 2020-03-16 08:34:29 -04:00
write.c NFS: Assume cred is pinned by open context in I/O requests 2020-03-16 08:34:29 -04:00