Re: [PATCH] ALSA: hda: Annotate struct hda_conn_list with __counted_by

2023-09-23 Thread Takashi Iwai
> (for array indexing) and CONFIG_FORTIFY_SOURCE (for strcpy/memcpy-family > functions). > > As found with Coccinelle[1], add __counted_by for struct hda_conn_list. > > [1] > https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci > > Cc: Ja

Re: [PATCH] ALSA: usx2y: Annotate struct snd_usx2y_urb_seq with __counted_by

2023-09-23 Thread Takashi Iwai
ember, move its initialization earlier. > > [1] > https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci > > Cc: Jaroslav Kysela > Cc: Takashi Iwai > Cc: alsa-de...@alsa-project.org > Signed-off-by: Kees Cook Applied now. Thanks. Takashi

Re: [PATCH][next] ALSA: 6fire: Fix undefined behavior bug in struct comm_runtime

2023-10-06 Thread Takashi Iwai
On Fri, 29 Sep 2023 17:59:22 +0200, Gustavo A. R. Silva wrote: > > `struct urb` is a flexible structure, which means that it contains a > flexible-array member at the bottom. This could potentially lead to an > overwrite of the objects following `receiver` in `struct comm_runtime`, > among them so

Re: [PATCH][next] ALSA: 6fire: Fix undefined behavior bug in struct midi_runtime

2023-10-06 Thread Takashi Iwai
On Fri, 29 Sep 2023 18:06:32 +0200, Gustavo A. R. Silva wrote: > > `struct urb` is a flexible structure, which means that it contains a > flexible-array member at the bottom. This could potentially lead to an > overwrite of the objects following `out_urb` in `struct midi_runtime`, > among them a f

Re: [PATCH v2][next] ALSA: firewire-lib: Avoid -Wflex-array-member-not-at-end warning

2024-03-26 Thread Takashi Iwai
On Tue, 26 Mar 2024 02:59:34 +0100, Gustavo A. R. Silva wrote: > > Use the `DEFINE_FLEX()` helper for an on-stack definition of a > flexible structure where the size of the flexible-array member > is known at compile-time, and refactor the rest of the code, > accordingly. > > So, with these chang

Re: [PATCH] ASoC: dapm: fix bounds checker error in dapm_widget_list_create

2024-10-29 Thread Takashi Iwai
On Tue, 29 Oct 2024 13:11:32 +0100, Amadeusz Sławiński wrote: > > On 10/29/2024 11:30 AM, Takashi Iwai wrote: > > On Tue, 29 Oct 2024 10:50:21 +0100, > > Amadeusz Sławiński wrote: > >> > >> On 10/28/2024 11:50 PM, Aleksei Vetrov wrote: > >>> The w

Re: [PATCH] ASoC: dapm: fix bounds checker error in dapm_widget_list_create

2024-10-29 Thread Takashi Iwai
On Tue, 29 Oct 2024 10:50:21 +0100, Amadeusz Sławiński wrote: > > On 10/28/2024 11:50 PM, Aleksei Vetrov wrote: > > The widgets array in the snd_soc_dapm_widget_list has a __counted_by > > attribute attached to it, which points to the num_widgets variable. This > > attribute is used in bounds chec

Re: [PATCH] ALSA: ctxfi: change dao_set_input functions from kzalloc to kcalloc

2025-03-10 Thread Takashi Iwai
On Sat, 08 Mar 2025 19:52:59 +0100, Ethan Carter Edwards wrote: > > We are trying to get rid of all multiplications from allocation > functions to prevent potential integer overflows. Here the > multiplication is probably safe, but using kcalloc() is more > appropriate and improves readability. Th