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

tools/testing/nvdimm: 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
+3 -3
tools/testing/nvdimm/test/nfit_test.h
··· 51 51 __u32 nfit_device_handle; 52 52 __u32 _reserved; 53 53 __u64 dpa; 54 - } __packed devices[0]; 54 + } __packed devices[]; 55 55 56 56 } __packed; 57 57 ··· 74 74 struct nd_error_stat_query_record { 75 75 __u64 err_inj_stat_spa_range_base; 76 76 __u64 err_inj_stat_spa_range_length; 77 - } __packed record[0]; 77 + } __packed record[]; 78 78 } __packed; 79 79 80 80 #define ND_INTEL_SMART 1 ··· 180 180 __u32 context; 181 181 __u32 offset; 182 182 __u32 length; 183 - __u8 data[0]; 183 + __u8 data[]; 184 184 /* this field is not declared due ot variable data from input */ 185 185 /* __u32 status; */ 186 186 } __packed;