mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Srinivas Kandagatla <srinivas.kandagatla@oss.qualcomm.com>
To: me@dawidwrobel.com, Srinivas Kandagatla <srini@kernel.org>,
	Liam Girdwood <lgirdwood@gmail.com>,
	Mark Brown <broonie@kernel.org>, Jaroslav Kysela <perex@perex.cz>,
	Takashi Iwai <tiwai@suse.com>,
	Pierre-Louis Bossart <pierre-louis.bossart@linux.dev>
Cc: linux-sound@vger.kernel.org, linux-arm-msm@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] ASoC: codecs: lpass-wsa-macro: Fix enum kcontrol accesses
Date: Thu, 30 Jul 2026 00:01:11 +0100	[thread overview]
Message-ID: <e30d907e-19ee-486e-823b-df86587bb724@oss.qualcomm.com> (raw)
In-Reply-To: <20260729-worktree-lpass-tx-macro-enum-fix-v1-2-0cf02c681332@dawidwrobel.com>

On 7/29/26 8:38 PM, Dawid Wróbel via B4 Relay wrote:
> From: Dawid Wróbel <me@dawidwrobel.com>
> 
> The "EAR SPKR PA Gain" control is enumerated, but
> wsa_macro_ear_spkr_pa_gain_get() and _put() access its value
> through ucontrol->value.integer.value[0] (a long) instead of
> ucontrol->value.enumerated.item[0] (an unsigned int).
> 
> This same pattern was fixed in the sibling drivers by
> commit bcfe5f76cc40 ("ASoC: codecs: rx-macro: fix accessing array
> out of bounds for enum type") and
> commit 0ea5eff7c606 ("ASoC: codecs: va-macro: fix accessing array
> out of bounds for enum type"), but wsa-macro was missed.
> 
> On 64-bit kernels built with CONFIG_SND_CTL_DEBUG, the elem value
> sanity check catches the 4 bytes written past the enumerated item
> and every read of this control fails with -EINVAL (access overflow).
> 
> Fixes: 809bcbcecebf ("ASoC: codecs: lpass-wsa-macro: Add support to WSA Macro")
> Assisted-by: Claude:claude-fable-5
> Signed-off-by: Dawid Wróbel <me@dawidwrobel.com>
> ---
>  sound/soc/codecs/lpass-wsa-macro.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 

Thanks for fixing these,

while you are at it , can you also fix wsa_macro_rx_mux_put too, it
seems to suffer the same issue.

Also can you add CC Stable.

--srini

> diff --git a/sound/soc/codecs/lpass-wsa-macro.c b/sound/soc/codecs/lpass-wsa-macro.c
> index 5ad0448af649..c88d13c0770b 100644
> --- a/sound/soc/codecs/lpass-wsa-macro.c
> +++ b/sound/soc/codecs/lpass-wsa-macro.c
> @@ -2064,7 +2064,7 @@ static int wsa_macro_ear_spkr_pa_gain_get(struct snd_kcontrol *kcontrol,
>  	struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
>  	struct wsa_macro *wsa = snd_soc_component_get_drvdata(component);
>  
> -	ucontrol->value.integer.value[0] = wsa->ear_spkr_gain;
> +	ucontrol->value.enumerated.item[0] = wsa->ear_spkr_gain;
>  
>  	return 0;
>  }
> @@ -2075,7 +2075,7 @@ static int wsa_macro_ear_spkr_pa_gain_put(struct snd_kcontrol *kcontrol,
>  	struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
>  	struct wsa_macro *wsa = snd_soc_component_get_drvdata(component);
>  
> -	wsa->ear_spkr_gain =  ucontrol->value.integer.value[0];
> +	wsa->ear_spkr_gain =  ucontrol->value.enumerated.item[0];
>  
>  	return 0;
>  }
> 


      reply	other threads:[~2026-07-29 23:01 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-29 19:38 [PATCH 0/2] ASoC: codecs: lpass-{tx,wsa}-macro: fix " Dawid Wróbel via B4 Relay
2026-07-29 19:38 ` [PATCH 1/2] ASoC: codecs: lpass-tx-macro: Fix " Dawid Wróbel via B4 Relay
2026-07-29 23:02   ` Srinivas Kandagatla
2026-07-29 19:38 ` [PATCH 2/2] ASoC: codecs: lpass-wsa-macro: " Dawid Wróbel via B4 Relay
2026-07-29 23:01   ` Srinivas Kandagatla [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=e30d907e-19ee-486e-823b-df86587bb724@oss.qualcomm.com \
    --to=srinivas.kandagatla@oss.qualcomm.com \
    --cc=broonie@kernel.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=me@dawidwrobel.com \
    --cc=perex@perex.cz \
    --cc=pierre-louis.bossart@linux.dev \
    --cc=srini@kernel.org \
    --cc=tiwai@suse.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®