From: Takashi Iwai <tiwai@suse.de>
To: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Cc: Linux-ALSA <alsa-devel@alsa-project.org>
Subject: Re: [PATCH] ALSA: hda/ca0132: fixup buffer overrun at tuning_ctl_set()
Date: Tue, 14 Mar 2023 17:05:06 +0100 [thread overview]
Message-ID: <87fsa7b9ot.wl-tiwai@suse.de> (raw)
In-Reply-To: <87sfe9eap7.wl-kuninori.morimoto.gx@renesas.com>
On Mon, 13 Mar 2023 01:50:28 +0100,
Kuninori Morimoto wrote:
>
> tuning_ctl_set() might have buffer overrun at (X) if it didn't break
> from loop by matching (A).
>
> static int tuning_ctl_set(...)
> {
> for (i = 0; i < TUNING_CTLS_COUNT; i++)
> (A) if (nid == ca0132_tuning_ctls[i].nid)
> break;
>
> snd_hda_power_up(...);
> (X) dspio_set_param(..., ca0132_tuning_ctls[i].mid, ...);
> snd_hda_power_down(...); ^
>
> return 1;
> }
>
> We will get below error by cppcheck
>
> sound/pci/hda/patch_ca0132.c:4229:2: note: After for loop, i has value 12
> for (i = 0; i < TUNING_CTLS_COUNT; i++)
> ^
> sound/pci/hda/patch_ca0132.c:4234:43: note: Array index out of bounds
> dspio_set_param(codec, ca0132_tuning_ctls[i].mid, 0x20,
> ^
> This patch cares non match case.
>
> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Thanks, applied now.
Takashi
prev parent reply other threads:[~2023-03-14 16:06 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-13 0:50 [PATCH] ALSA: hda/ca0132: fixup buffer overrun at tuning_ctl_set() Kuninori Morimoto
2023-03-14 16:05 ` Takashi Iwai [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87fsa7b9ot.wl-tiwai@suse.de \
--to=tiwai@suse.de \
--cc=alsa-devel@alsa-project.org \
--cc=kuninori.morimoto.gx@renesas.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.