linux/sound/usb/usx2y
Kees Cook f5cc9cdfc9 ALSA: usx2y: Annotate struct snd_usx2y_urb_seq with __counted_by
Prepare for the coming implementation by GCC and Clang of the __counted_by
attribute. Flexible array members annotated with __counted_by can have
their accesses bounds-checked at run-time checking via CONFIG_UBSAN_BOUNDS
(for array indexing) and CONFIG_FORTIFY_SOURCE (for strcpy/memcpy-family
functions).

As found with Coccinelle[1], add __counted_by for struct snd_usx2y_urb_seq.
Additionally, since the element count member must be set before accessing
the annotated flexible array member, move its initialization earlier.

[1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci

Cc: Jaroslav Kysela <perex@perex.cz>
Cc: Takashi Iwai <tiwai@suse.com>
Cc: alsa-devel@alsa-project.org
Signed-off-by: Kees Cook <keescook@chromium.org>
Link: https://lore.kernel.org/r/20230922175046.work.766-kees@kernel.org
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-09-23 12:36:59 +02:00
..
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
us122l.c mm: replace vma->vm_flags direct modifications with modifier calls 2023-02-09 16:51:39 -08:00
us122l.h ALSA: usx2y: Coding style fixes 2021-05-17 16:03:58 +02:00
usb_stream.c sound: usb: remove third argument of usb_maxpacket() 2022-04-23 10:33:53 +02:00
usb_stream.h ALSA: usx2y: Coding style fixes 2021-05-17 16:03:58 +02:00
usbus428ctldefs.h ALSA: usx2y: Fix potential leaks of uninitialized memory 2021-05-17 16:04:10 +02:00
usbusx2y.c ALSA: Fix some typo 2021-12-06 10:04:05 +01:00
usbusx2y.h ALSA: usx2y: Annotate struct snd_usx2y_urb_seq with __counted_by 2023-09-23 12:36:59 +02:00
usbusx2yaudio.c ALSA: usx2y: Annotate struct snd_usx2y_urb_seq with __counted_by 2023-09-23 12:36:59 +02:00
usx2y.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 156 2019-05-30 11:26:35 -07:00
usx2yhwdeppcm.c mm: replace vma->vm_flags direct modifications with modifier calls 2023-02-09 16:51:39 -08:00
usx2yhwdeppcm.h ALSA: usx2y: Avoid camelCase 2021-05-17 16:03:34 +02:00
usX2Yhwdep.c mm: replace vma->vm_flags direct modifications with modifier calls 2023-02-09 16:51:39 -08:00
usX2Yhwdep.h ALSA: usx2y: Fix spaces 2021-05-17 16:03:46 +02:00