linux-stable/sound/pci/mixart
Gustavo A. R. Silva 4040fc51ca ALSA: mixart: Replace one-element arrays with simple object declarations
One-element arrays are deprecated, and we are replacing them with flexible
array members instead. However, in this case it seems those one-element
arrays have never actually been used as fake flexible arrays.

See this code that dates from Linux-2.6.12-rc2 initial git repository build
(commit 1da177e4c3 ("Linux-2.6.12-rc2")):

sound/pci/mixart/mixart_core.h:
 215 struct mixart_stream_state_req
 216 {
 217         u32                 delayed;
 218         u64                 scheduler;
 219         u32                 reserved4np[3];
 220         u32                 stream_count;  /* set to 1 for instance */
 221         struct mixart_flow_info  stream_info;   /* could be an array[stream_count] */
 222 } __attribute__((packed));

sound/pci/mixart/mixart.c:
 388
 389         memset(&stream_state_req, 0, sizeof(stream_state_req));
 390         stream_state_req.stream_count = 1;
 391         stream_state_req.stream_info.stream_desc.uid_pipe = stream->pipe->group_uid;
 392         stream_state_req.stream_info.stream_desc.stream_idx = stream->substream->number;
 393

So, taking the code above as example, replace multiple one-element
arrays with simple object declarations, and refactor the rest of the
code, accordingly.

This helps with the ongoing efforts to tighten the FORTIFY_SOURCE
routines on memcpy() and help us make progress towards globally
enabling -fstrict-flex-arrays=3 [1].

This results in no differences in binary output.

Link: https://github.com/KSPP/linux/issues/79
Link: https://github.com/KSPP/linux/issues/296
Link: https://gcc.gnu.org/pipermail/gcc-patches/2022-October/602902.html [1]
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Link: https://lore.kernel.org/r/ZGfiFjcL8+r3mayq@work
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-05-20 10:17:53 +02:00
..
Makefile treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
mixart.c ALSA: mixart: Replace one-element arrays with simple object declarations 2023-05-20 10:17:53 +02:00
mixart.h ALSA: mixart: Correct comment wrt obsoleted tasklet usage 2020-09-09 18:34:36 +02:00
mixart_core.c ALSA: mixart: Add sanity check for timer notify streams 2021-12-07 16:35:58 +01:00
mixart_core.h ALSA: mixart: Replace one-element arrays with simple object declarations 2023-05-20 10:17:53 +02:00
mixart_hwdep.c ALSA: mixart: Fix assignment in if condition 2021-06-09 17:30:15 +02:00
mixart_hwdep.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 156 2019-05-30 11:26:35 -07:00
mixart_mixer.c ALSA: mixart: Fix assignment in if condition 2021-06-09 17:30:15 +02:00
mixart_mixer.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 156 2019-05-30 11:26:35 -07:00