]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
bcachefs: Replace zero-length arrays with flexible-array members
authorGustavo A. R. Silva <gustavoars@kernel.org>
Tue, 28 Nov 2023 18:22:55 +0000 (12:22 -0600)
committerKent Overstreet <kent.overstreet@linux.dev>
Mon, 1 Jan 2024 16:47:39 +0000 (11:47 -0500)
Fake flexible arrays (zero-length and one-element arrays) are
deprecated, and should be replaced by flexible-array members.

So, replace zero-length arrays with flexible-array members
in multiple structures.

Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
fs/bcachefs/bcachefs_ioctl.h
fs/bcachefs/io_read.c
fs/bcachefs/move.c
fs/bcachefs/replicas_types.h

index 44ba7a87aea726ee5626d6a86957eb37cd1c5c58..43822c17297c697c070717aa34458a88e830a676 100644 (file)
@@ -276,7 +276,7 @@ struct bch_ioctl_fs_usage {
        __u32                   replica_entries_bytes;
        __u32                   pad;
 
-       struct bch_replicas_usage replicas[0];
+       struct bch_replicas_usage replicas[];
 };
 
 /*
@@ -313,7 +313,7 @@ struct bch_ioctl_dev_usage_v2 {
        __u32                   bucket_size;
        __u64                   nr_buckets;
 
-       struct bch_ioctl_dev_usage_type  d[0];
+       struct bch_ioctl_dev_usage_type d[];
 };
 
 /*
index 3281c4dd1d5252840fa0c13f1c7c4f720108ebdf..4c9eaf7cea8df07835e9b217dff097b73581fa60 100644 (file)
@@ -80,7 +80,7 @@ struct promote_op {
        struct bpos             pos;
 
        struct data_update      write;
-       struct bio_vec          bi_inline_vecs[0]; /* must be last */
+       struct bio_vec          bi_inline_vecs[]; /* must be last */
 };
 
 static const struct rhashtable_params bch_promote_params = {
index a6db46a70f15760d0eca4f3e9867f574281848eb..bc545613f793a109d669ed99443d30881bed08be 100644 (file)
@@ -70,7 +70,7 @@ struct moving_io {
 
        struct data_update              write;
        /* Must be last since it is variable size */
-       struct bio_vec                  bi_inline_vecs[0];
+       struct bio_vec                  bi_inline_vecs[];
 };
 
 static void move_free(struct moving_io *io)
index 030324078bbab10eda32082a6443af297ea00871..ac90d142c4e87dde7d5df8753937e6ae0f0cb440 100644 (file)
@@ -21,7 +21,7 @@ struct replicas_delta_list {
        u64                     nr_inodes;
        u64                     persistent_reserved[BCH_REPLICAS_MAX];
        struct                  {} memset_end;
-       struct replicas_delta   d[0];
+       struct replicas_delta   d[];
 };
 
 #endif /* _BCACHEFS_REPLICAS_TYPES_H */