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

ath: Replace zero-length arrays with flexible-array members

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://www.kernel.org/doc/html/v5.16/process/deprecated.html#zero-length-and-one-element-arrays

Link: https://github.com/KSPP/linux/issues/78
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Reviewed-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
Link: https://lore.kernel.org/r/20220216194915.GA904081@embeddedor

authored by

Gustavo A. R. Silva and committed by
Kalle Valo
cfb72c08 d9bc1416

+2 -2
+2 -2
drivers/net/wireless/ath/spectral_common.h
··· 108 108 u8 avgpwr_db; 109 109 u8 max_exp; 110 110 111 - u8 data[0]; 111 + u8 data[]; 112 112 } __packed; 113 113 114 114 struct fft_sample_ath11k { ··· 123 123 __be32 tsf; 124 124 __be32 noise; 125 125 126 - u8 data[0]; 126 + u8 data[]; 127 127 } __packed; 128 128 129 129 #endif /* SPECTRAL_COMMON_H */