Re: [PATCH] ALSA: fireworks: bound device-supplied status before string array lookup
From: Takashi Sakamoto
Date: Thu Apr 09 2026 - 18:54:42 EST
Hi,
On Thu, Apr 09, 2026 at 04:05:54PM +0200, Greg Kroah-Hartman wrote:
> The status field in an EFW response is a 32-bit value supplied by the
> firewire device. efr_status_names[] has 17 entries so a status value
> outside that range goes off into the weeds when looking at the %s value.
>
> Even worse, the status could return EFR_STATUS_INCOMPLETE which is
> 0x80000000, and is obviously not in that array of potential strings.
>
> Fix this up by properly bounding the index against the array size and
> printing "unknown" if it's not recognized.
>
> Cc: Clemens Ladisch <clemens@xxxxxxxxxx>
> Cc: Takashi Sakamoto <o-takashi@xxxxxxxxxxxxx>
> Cc: Jaroslav Kysela <perex@xxxxxxxx>
> Cc: Takashi Iwai <tiwai@xxxxxxxx>
> Fixes: bde8a8f23bbe ("ALSA: fireworks: Add transaction and some commands")
> Cc: stable <stable@xxxxxxxxxx>
> Assisted-by: gregkh_clanker_t1000
> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
> ---
> sound/firewire/fireworks/fireworks_command.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
Good catch.
Reviewed-by: Takashi Sakamoto <o-takashi@xxxxxxxxxxxxx>
Thanks
Takashi Sakamoto