Skip to content

Commit b942a52

Browse files
bcache: Replace zero-length arrays with DECLARE_FLEX_ARRAY() helper
Zero-length arrays are deprecated and we are moving towards adopting C99 flexible-array members, instead. So, replace zero-length arrays declarations in anonymous union with the new DECLARE_FLEX_ARRAY() helper macro. This helper allows for flexible-array members in unions. Link: KSPP#193 Link: KSPP#213 Link: https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html Reviewed-by: Kees Cook <[email protected]> Signed-off-by: Gustavo A. R. Silva <[email protected]>
1 parent 06919d2 commit b942a52

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

drivers/md/bcache/bcache_ondisk.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -359,8 +359,8 @@ struct jset {
359359
__u64 prio_bucket[MAX_CACHES_PER_SET];
360360

361361
union {
362-
struct bkey start[0];
363-
__u64 d[0];
362+
DECLARE_FLEX_ARRAY(struct bkey, start);
363+
DECLARE_FLEX_ARRAY(__u64, d);
364364
};
365365
};
366366

@@ -424,8 +424,8 @@ struct bset {
424424
__u32 keys;
425425

426426
union {
427-
struct bkey start[0];
428-
__u64 d[0];
427+
DECLARE_FLEX_ARRAY(struct bkey, start);
428+
DECLARE_FLEX_ARRAY(__u64, d);
429429
};
430430
};
431431

0 commit comments

Comments
 (0)