]> git.ipfire.org Git - thirdparty/linux.git/commit
ALSA: seq: Use flexible array for device arguments
authorCássio Gabriel <cassiogabrielcontato@gmail.com>
Sun, 31 May 2026 23:41:41 +0000 (20:41 -0300)
committerTakashi Iwai <tiwai@suse.de>
Mon, 1 Jun 2026 09:28:32 +0000 (11:28 +0200)
commit8a2d0b5496850403d1105efbbe54aa8fc68cae6f
tree47c0e38d39234ad8f6eb3ac8303ed78a06d19dde
parent635b5c6622f317a06c11ee050c2665c1085b68a0
ALSA: seq: Use flexible array for device arguments

snd_seq_device_new() allocates struct snd_seq_device together with a
caller-specific argument area. SNDRV_SEQ_DEVICE_ARGPTR() reaches that
area by adding sizeof(struct snd_seq_device) to the object pointer.

Make the trailing storage explicit with a flexible array and allocate it
with kzalloc_flex(). This makes the object layout self-describing and
avoids open-coded size arithmetic in the allocation and accessor.

Reject negative argsize values before calculating the allocation size.
Current in-tree callers pass either zero or sizeof() values, but the
function takes an int size argument and should not let a negative value
flow into unsigned allocation arithmetic.

Signed-off-by: Cássio Gabriel <cassiogabrielcontato@gmail.com>
Link: https://patch.msgid.link/20260531-alsa-seq-flex-args-v2-1-6e068d4ed9b0@gmail.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
include/sound/seq_device.h
sound/core/seq_device.c