summaryrefslogtreecommitdiff
path: root/include/sound/control.h
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2024-07-26 17:28:15 +0200
committerTakashi Iwai <tiwai@suse.de>2024-07-30 07:45:37 +0200
commit4e9652003bc39032c3ab79e607aa3d1913c7cf57 (patch)
treeabd0c6953ce30d7639fc33dce9139e6cb23e26c2 /include/sound/control.h
parent3c0e1ed9c87877d064c705a60db5fdb31a91e985 (diff)
ALSA: control: Annotate snd_kcontrol with __counted_by()
struct snd_kcontrol contains a flex array of snd_kcontrol_volatile objects at its end, and the array size is stored in count field. This can be annotated gracefully with __counted_by() for catching possible array overflows. One additional change is the order of the count field initialization; The assignment of the count field is moved before assignment of vd[] elements for avoiding false-positive warnings from compilers. Link: https://patch.msgid.link/20240726152840.8629-1-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'include/sound/control.h')
-rw-r--r--include/sound/control.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/include/sound/control.h b/include/sound/control.h
index c1659036c4a7..13511c50825f 100644
--- a/include/sound/control.h
+++ b/include/sound/control.h
@@ -81,7 +81,7 @@ struct snd_kcontrol {
unsigned long private_value;
void *private_data;
void (*private_free)(struct snd_kcontrol *kcontrol);
- struct snd_kcontrol_volatile vd[]; /* volatile data */
+ struct snd_kcontrol_volatile vd[] __counted_by(count); /* volatile data */
};
#define snd_kcontrol(n) list_entry(n, struct snd_kcontrol, list)