]> www.infradead.org Git - users/jedix/linux-maple.git/commit
ASoC: Use __counted_by() annotation for snd_soc_pcm_runtime
authorTakashi Iwai <tiwai@suse.de>
Fri, 26 Jul 2024 15:52:36 +0000 (17:52 +0200)
committerMark Brown <broonie@kernel.org>
Mon, 29 Jul 2024 00:18:42 +0000 (01:18 +0100)
commitaaa5e1aa39074fb466f6ef3df4de6903741dfeec
treef5ea64315c83253c38162a9a81f2d15a32d7e295
parent42eb47310f89eca3226e8e427bc9d571149dc866
ASoC: Use __counted_by() annotation for snd_soc_pcm_runtime

The struct snd_soc_pcm_runtime has a flex array of snd_soc_component
objects at its end, and the size is kept in num_components field.
We can add __counted_by() annotation for compiler's assistance to
catch array overflows.

A slight additional change is the assignment of rtd->components[];
the array counter has to be incremented at first for avoiding
false-positive reports from compilers.

Also, the allocation size of snd_soc_pcm_runtime is cleaned up with
the standard struct_size() helper, too.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://patch.msgid.link/20240726155237.21961-1-tiwai@suse.de
Signed-off-by: Mark Brown <broonie@kernel.org>
include/sound/soc.h
sound/soc/soc-core.c