KSPP / linux

Linux kernel source tree (Kernel Self Protection Project)
https://kernsec.org/wiki/index.php/Kernel_Self_Protection_Project
Other
80 stars 5 forks source link

Replace fake flexible arrays with C99 flexible-array members in include/uapi/sound/asoc.h #260

Closed GustavoARSilva closed 1 year ago

GustavoARSilva commented 1 year ago
220 struct snd_soc_tplg_vendor_array {
221         __le32 size;    /* size in bytes of the array, including all elements */
222         __le32 type;    /* SND_SOC_TPLG_TUPLE_TYPE_ */
223         __le32 num_elems;       /* number of elements in array */
224         union {
225                 struct snd_soc_tplg_vendor_uuid_elem uuid[0];
226                 struct snd_soc_tplg_vendor_value_elem value[0];
227                 struct snd_soc_tplg_vendor_string_elem string[0];
228         };
229 } __attribute__((packed));

-Warray-bounds warnings with GCC-13 and -fstrict-flex-arrays=3:

sound/soc/intel/avs/topology.c:256:25: warning: array subscript i is outside array bounds of ‘struct snd_soc_tplg_vendor_value_elem[0]’ [-Warray-bounds=]
sound/soc/intel/avs/topology.c:256:39: warning: array subscript i is outside array bounds of ‘struct snd_soc_tplg_vendor_value_elem[0]’ [-Warray-bounds=]
sound/soc/intel/avs/topology.c:230:25: warning: array subscript i is outside array bounds of ‘struct snd_soc_tplg_vendor_string_elem[0]’ [-Warray-bounds=]
sound/soc/intel/avs/topology.c:230:40: warning: array subscript i is outside array bounds of ‘struct snd_soc_tplg_vendor_string_elem[0]’ [-Warray-bounds=]
sound/soc/intel/avs/topology.c:204:25: warning: array subscript i is outside array bounds of ‘struct snd_soc_tplg_vendor_uuid_elem[0]’ [-Warray-bounds=]
sound/soc/intel/avs/topology.c:204:38: warning: array subscript i is outside array bounds of ‘struct snd_soc_tplg_vendor_uuid_elem[0]’ [-Warray-bounds=]
sound/soc/sof/topology.c:572:61: warning: array subscript i is outside array bounds of ‘struct snd_soc_tplg_vendor_value_elem[0]’ [-Warray-bounds=]
sound/soc/sof/topology.c:572:61: warning: array subscript i is outside array bounds of ‘struct snd_soc_tplg_vendor_value_elem[0]’ [-Warray-bounds=]
sound/soc/sof/topology.c:561:62: warning: array subscript i is outside array bounds of ‘struct snd_soc_tplg_vendor_string_elem[0]’ [-Warray-bounds=]
sound/soc/sof/topology.c:568:78: warning: array subscript i is outside array bounds of ‘struct snd_soc_tplg_vendor_string_elem[0]’ [-Warray-bounds=]
sound/soc/sof/topology.c:666:24: warning: array subscript i is outside array bounds of ‘struct snd_soc_tplg_vendor_value_elem[0]’ [-Warray-bounds=]
sound/soc/sof/topology.c:666:37: warning: array subscript i is outside array bounds of ‘struct snd_soc_tplg_vendor_value_elem[0]’ [-Warray-bounds=]
sound/soc/sof/topology.c:620:38: warning: array subscript i is outside array bounds of ‘struct snd_soc_tplg_vendor_string_elem[0]’ [-Warray-bounds=]
sound/soc/sof/topology.c:633:55: warning: array subscript i is outside array bounds of ‘struct snd_soc_tplg_vendor_string_elem[0]’ [-Warray-bounds=]
sound/soc/sof/topology.c:457:24: warning: array subscript i is outside array bounds of ‘struct snd_soc_tplg_vendor_uuid_elem[0]’ [-Warray-bounds=]
sound/soc/sof/topology.c:457:36: warning: array subscript i is outside array bounds of ‘struct snd_soc_tplg_vendor_uuid_elem[0]’ [-Warray-bounds=]
GustavoARSilva commented 1 year ago

https://lore.kernel.org/linux-hardening/YzIzUjUuJKf0mkKg@work/