Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

stm class: 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>

+3 -3
+1 -1
drivers/hwtracing/stm/policy.c
··· 34 34 unsigned int first_channel; 35 35 unsigned int last_channel; 36 36 /* this is the one that's exposed to the attributes */ 37 - unsigned char priv[0]; 37 + unsigned char priv[]; 38 38 }; 39 39 40 40 void *stp_policy_node_priv(struct stp_policy_node *pn)
+2 -2
drivers/hwtracing/stm/stm.h
··· 23 23 24 24 struct stp_master { 25 25 unsigned int nr_free; 26 - unsigned long chan_map[0]; 26 + unsigned long chan_map[]; 27 27 }; 28 28 29 29 struct stm_device { ··· 42 42 const struct config_item_type *pdrv_node_type; 43 43 /* master allocation */ 44 44 spinlock_t mc_lock; 45 - struct stp_master *masters[0]; 45 + struct stp_master *masters[]; 46 46 }; 47 47 48 48 #define to_stm_device(_d) \