mirror of
https://github.com/torvalds/linux.git
synced 2024-11-17 17:41:44 +00:00
drbd: Replace zero-length array with flexible-array
There is a regular need in the kernel to provide a way to declare having a dynamically sized set of trailing elements in a structure. Kernel code should always use “flexible array members”[1] for these cases. The older style of one-element or zero-length arrays should no longer be used[2]. [1] https://en.wikipedia.org/wiki/Flexible_array_member [2] https://github.com/KSPP/linux/issues/21 Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
This commit is contained in:
parent
6c48764aa4
commit
1060bfc8e2
@ -620,7 +620,7 @@ struct fifo_buffer {
|
||||
unsigned int head_index;
|
||||
unsigned int size;
|
||||
int total; /* sum of all values */
|
||||
int values[0];
|
||||
int values[];
|
||||
};
|
||||
extern struct fifo_buffer *fifo_alloc(unsigned int fifo_size);
|
||||
|
||||
|
@ -271,7 +271,7 @@ struct p_rs_param {
|
||||
u32 resync_rate;
|
||||
|
||||
/* Since protocol version 88 and higher. */
|
||||
char verify_alg[0];
|
||||
char verify_alg[];
|
||||
} __packed;
|
||||
|
||||
struct p_rs_param_89 {
|
||||
@ -305,7 +305,7 @@ struct p_protocol {
|
||||
u32 two_primaries;
|
||||
|
||||
/* Since protocol version 87 and higher. */
|
||||
char integrity_alg[0];
|
||||
char integrity_alg[];
|
||||
|
||||
} __packed;
|
||||
|
||||
@ -360,7 +360,7 @@ struct p_sizes {
|
||||
u16 dds_flags; /* use enum dds_flags here. */
|
||||
|
||||
/* optional queue_limits if (agreed_features & DRBD_FF_WSAME) */
|
||||
struct o_qlim qlim[0];
|
||||
struct o_qlim qlim[];
|
||||
} __packed;
|
||||
|
||||
struct p_state {
|
||||
@ -409,7 +409,7 @@ struct p_compressed_bm {
|
||||
*/
|
||||
u8 encoding;
|
||||
|
||||
u8 code[0];
|
||||
u8 code[];
|
||||
} __packed;
|
||||
|
||||
struct p_delay_probe93 {
|
||||
|
Loading…
Reference in New Issue
Block a user