linux-stable/fs/ceph
Gustavo A. R. Silva f682dc713c ceph: 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: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
2020-03-30 12:42:40 +02:00
..
acl.c ceph: remove unnecessary assignment in ceph_pre_init_acls() 2020-01-27 16:53:39 +01:00
addr.c ceph: move ceph_osdc_{read,write}pages to ceph.ko 2020-03-30 12:42:40 +02:00
cache.c ceph: replace zero-length array with flexible-array member 2020-03-30 12:42:40 +02:00
cache.h libceph, rbd, ceph: convert to use the new mount API 2019-11-27 22:28:37 +01:00
caps.c ceph: check inode type for CEPH_CAP_FILE_{CACHE,RD,REXTEND,LAZYIO} 2020-03-30 12:42:40 +02:00
ceph_frag.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
debugfs.c libceph: drop CEPH_DEFINE_SHOW_FUNC 2020-03-30 12:42:40 +02:00
dir.c ceph: print dentry offset in hex and fix xattr_version type 2020-01-27 16:53:39 +01:00
export.c ceph: move static keyword to the front of declarations 2019-09-16 12:06:25 +02:00
file.c ceph: check POOL_FLAG_FULL/NEARFULL in addition to OSDMAP_FULL/NEARFULL 2020-03-23 13:07:08 +01:00
inode.c ceph: add refcounting for Fx caps 2020-03-30 12:42:40 +02:00
io.c ceph: add buffered/direct exclusionary locking for reads and writes 2019-09-16 12:06:25 +02:00
io.h ceph: add buffered/direct exclusionary locking for reads and writes 2019-09-16 12:06:25 +02:00
ioctl.c libceph, ceph: move ceph_calc_file_object_mapping() to striper.c 2018-04-02 10:12:43 +02:00
ioctl.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
Kconfig ceph: add selinux support 2019-07-08 14:01:42 +02:00
locks.c ceph: check if file lock exists before sending unlock request 2020-03-30 12:42:40 +02:00
Makefile ceph: move net/ceph/ceph_fs.c to fs/ceph/util.c 2020-01-27 16:53:40 +01:00
mds_client.c ceph: check inode type for CEPH_CAP_FILE_{CACHE,RD,REXTEND,LAZYIO} 2020-03-30 12:42:40 +02:00
mds_client.h ceph: close holes in structs ceph_mds_session and ceph_mds_request 2020-01-27 16:53:40 +01:00
mdsmap.c ceph: add possible_max_rank and make the code more readable 2020-01-27 16:53:40 +01:00
quota.c ceph: fix infinite loop in get_quota_realm() 2019-07-08 14:01:42 +02:00
snap.c ceph: fix memory leak in ceph_cleanup_snapid_map() 2020-03-23 13:07:08 +01:00
strings.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
super.c ceph: noacl mount option is effectively ignored 2020-02-11 17:04:40 +01:00
super.h ceph: check inode type for CEPH_CAP_FILE_{CACHE,RD,REXTEND,LAZYIO} 2020-03-30 12:42:40 +02:00
util.c ceph: move net/ceph/ceph_fs.c to fs/ceph/util.c 2020-01-27 16:53:40 +01:00
xattr.c ceph: print name of xattr in __ceph_{get,set}xattr() douts 2020-01-27 16:53:40 +01:00