twx-linux/include/linux/sunrpc
Gustavo A. R. Silva 469aef23aa sunrpc: 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 76497732932f ("cxgb3/l2t: Fix undefined behaviour")

Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
2020-03-16 12:04:31 -04:00
..
addr.h
auth_gss.h sunrpc: remove __KERNEL__ ifdefs 2019-11-12 11:43:29 -05:00
auth.h SUNRPC: Remove broken gss_mech_list_pseudoflavors() 2020-01-15 10:54:32 -05:00
bc_xprt.h SUNRPC: Destroy the back channel when we destroy the host transport 2019-10-30 12:04:35 -04:00
cache.h nfs: use time64_t internally 2019-12-18 18:07:32 +01:00
clnt.h This is a relatively quiet cycle for nfsd, mainly various bugfixes. 2019-12-07 16:56:00 -08:00
debug.h
gss_api.h SUNRPC: Remove broken gss_mech_list_pseudoflavors() 2020-01-15 10:54:32 -05:00
gss_asn1.h
gss_err.h sunrpc: remove __KERNEL__ ifdefs 2019-11-12 11:43:29 -05:00
gss_krb5_enctypes.h
gss_krb5.h sunrpc: convert to time64_t for expiry 2020-01-15 10:54:30 -05:00
metrics.h
msg_prot.h sunrpc: remove __KERNEL__ ifdefs 2019-11-12 11:43:29 -05:00
rpc_pipe_fs.h sunrpc: remove __KERNEL__ ifdefs 2019-11-12 11:43:29 -05:00
rpc_rdma.h
sched.h NFS Client Updates for Linux 5.3 2019-09-26 12:20:14 -07:00
stats.h proc: convert everything to "struct proc_ops" 2020-02-04 03:05:26 +00:00
svc_rdma.h svcrdma: Use llist for managing cache of recv_ctxts 2019-08-19 10:59:28 -04:00
svc_xprt.h
svc.h sunrpc: Replace zero-length array with flexible-array member 2020-03-16 12:04:31 -04:00
svcauth_gss.h sunrpc: remove __KERNEL__ ifdefs 2019-11-12 11:43:29 -05:00
svcauth.h sunrpc: remove __KERNEL__ ifdefs 2019-11-12 11:43:29 -05:00
svcsock.h
timer.h
types.h
xdr.h sunrpc: remove __KERNEL__ ifdefs 2019-11-12 11:43:29 -05:00
xprt.h This is a relatively quiet cycle for nfsd, mainly various bugfixes. 2019-12-07 16:56:00 -08:00
xprtmultipath.h
xprtrdma.h xprtrdma: Boost client's max slot table size to match Linux server 2019-08-20 11:17:16 -04:00
xprtsock.h This is a relatively quiet cycle for nfsd, mainly various bugfixes. 2019-12-07 16:56:00 -08:00