From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796075232; b=WIV7eASoLZqL977drF10hTILhqVsWQ4p+tJBmv+WtNX1uFECimA0aL2GKxlym85Ve+V+ NC3J2gzGXVD687RYD9jFue8ZIpec1Zix/ZddyUSxHHPgFv4A7/rCJBlh0xmzZfjLkN4J0 +y5vAfOZV8D6nb7M8++GyT1FPXcWn8CjZZ55s8QFi/CB73DnQ0KNCD2ZdrD6EBqEFlwEF pbJlJZdqnyTHYthvkN0sXkRNg+AFJexTaqSuw3GVovhCL3KnvSxIUtM2PM0tdYWpPC/mO L51Y4E5FDUM06Wy+VeHT79KbHiDqni8cgrM5bhLgIj2EfrxhOcYfSN5aYgdPMCXBIkA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796075232; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=oFAtjkOLVPtYX/P3UBunz/aEbRQ0XEb0yk8FomcdE80=; b=zu3ckGRQgUyuju+zLagUkzITAmCcejSW6rS0eSneDbJ7LvZGO91Ib5IyhaL1ZfJbb/Ih q3IoV5YmiCnQMjGyiVa30oYj9KpdTOOLBOG4aVBDrvdq9KftWuavr+pSfeX8K9zwCOARj 3UOwxD7Gw5WvsdnyKjang44umvD2guK7MFAbVqqnUOna7K8qEIg4YcK1j8z+vJLj94Z8c tEUx+7dxZDJGV+eWlC7d7aI1LQeQQZrdSd65RBP9QhBmJTaNB/CMZnZ+UifrRoJr2MMoG 8hJ6Nq9Gwbs2r/2mO0E3j9Gt2Xy5LuVGLnpLF4SWVjclKfgjo3n7j/BbBrI0i1c6Qrw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=IFcDODsI; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B34AC606A31A; Mon, 30 Nov 2026 21:47:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=IFcDODsI Received: by smtp.kernel.org (Postfix) with ESMTPSA id 089E81F000C1; Mon, 30 Nov 2026 21:47:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796075232; bh=oFAtjkOLVPtYX/P3UBunz/aEbRQ0XEb0yk8FomcdE80=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=IFcDODsIIsT0QR/cnTWR9PdyJBaMp0CT8nvy6Pmi5/gT7spsvuJYK11ZPN+rsTRMO xnoI6dkMen+F3MPQl1yRzkrfrkXwfDpRZbvP76lJKPO1UWuzP87ghwjkjabJMGEDtM dq39Je3gMiPzeXBkA7cTixmhyAkYqOAgLvg+GjqWA1mW8l14+GmnaI7NjJmVP1FfTN 0DHV1Q7u0dibfMYUlEcsHZPfiZ5XeEjS95Aiwby+G1qkPDa+DZwUK99kuQwv+cBT6V 1nzEOH6cM2YI5+7U3IyhN6QvsSoIgn3ciMpx4/bysUPOrJ/jVOaaiZDU9YKkL76/56 grWLS5z/Btv5g== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH v8 5/9] ASoC: qcom: lpass-va-macro: Add SoundWire microphone support Reply-To: sashiko-reviews@lists.linux.dev To: "Mohammad Rafi Shaik" Cc: linux-sound@vger.kernel.org, devicetree@vger.kernel.org, robh@kernel.org, conor+dt@kernel.org In-Reply-To: <20261201-add_shikra_support-v8-5-5e56d0ad3810@oss.qualcomm.com> References: <20261201-add_shikra_support-v8-0-5e56d0ad3810@oss.qualcomm.com> <20261201-add_shikra_support-v8-5-5e56d0ad3810@oss.qualcomm.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Mon, 30 Nov 2026 21:47:11 +0000 X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [Medium] ASoC: lpass-va-macro: unvalidated index in va_macro_put_dec_mux() -- commit b829bf6e53b2485766d0cdfdea3eb6d248f500f4 Author: Mohammad Rafi Shaik ASoC: qcom: lpass-va-macro: Add SoundWire microphone support This commit adds DAPM widgets, routes, and decimator mux callbacks to support routing SoundWire microphone inputs to the VA decimators. > diff --git a/sound/soc/codecs/lpass-va-macro.c b/sound/soc/codecs/lpass-v= a-macro.c > index 399468ebea0bf..87532e4da5d20 100644 > --- a/sound/soc/codecs/lpass-va-macro.c > +++ b/sound/soc/codecs/lpass-va-macro.c [ ... ] > @@ -755,10 +771,69 @@ static int va_macro_put_dec_enum(struct snd_kcontro= l *kcontrol, > return -EINVAL; > } > =20 > - if (val !=3D 0) > + /* > + * SMIC enums use shift 0 (lower nibble of CFG0), DMIC enums use > + * shift 4 (upper nibble of CFG0). Use e->shift_l to distinguish them > + * without relying on widget name comparisons. > + */ > + smic_mux =3D (e->shift_l =3D=3D 0); > + > + /* > + * Both muxes feed the same decimator and share ADC_DMIC_SEL, so only > + * the one the decimator is routed through may program it. A write to > + * the mux that is not part of the active path would otherwise switch > + * the input domain of a running capture. > + */ > + if (val !=3D 0 && smic_mux =3D=3D is_amic_enabled(component, decimator)) > snd_soc_component_update_bits(component, mic_sel_reg, > CDC_VA_TX_PATH_ADC_DMIC_SEL_MASK, > - CDC_VA_TX_PATH_ADC_DMIC_SEL_DMIC); > + smic_mux ? CDC_VA_TX_PATH_ADC_DMIC_SEL_ADC : > + CDC_VA_TX_PATH_ADC_DMIC_SEL_DMIC); > + > + return snd_soc_dapm_put_enum_double(kcontrol, ucontrol); > +} > + > +static int va_macro_put_dec_mux(struct snd_kcontrol *kcontrol, > + struct snd_ctl_elem_value *ucontrol) > +{ > + struct snd_soc_dapm_widget *widget =3D snd_soc_dapm_kcontrol_to_widget(= kcontrol); > + struct snd_soc_component *component =3D > + snd_soc_dapm_to_component(widget->dapm); > + struct soc_enum *e =3D (struct soc_enum *)kcontrol->private_value; > + unsigned int val; > + u16 mic_sel_reg; > + > + val =3D ucontrol->value.enumerated.item[0]; > + > + switch (e->reg) { > + case CDC_VA_INP_MUX_ADC_MUX0_CFG1: > + mic_sel_reg =3D CDC_VA_TX0_TX_PATH_CFG0; > + break; > + case CDC_VA_INP_MUX_ADC_MUX1_CFG1: > + mic_sel_reg =3D CDC_VA_TX1_TX_PATH_CFG0; > + break; > + case CDC_VA_INP_MUX_ADC_MUX2_CFG1: > + mic_sel_reg =3D CDC_VA_TX2_TX_PATH_CFG0; > + break; > + case CDC_VA_INP_MUX_ADC_MUX3_CFG1: > + mic_sel_reg =3D CDC_VA_TX3_TX_PATH_CFG0; > + break; > + default: > + dev_err(component->dev, "%s: e->reg: 0x%x not expected\n", > + __func__, e->reg); > + return -EINVAL; > + } > + > + /* > + * This mux selects the input domain of the decimator, so ADC_DMIC_SEL > + * has to follow it. When both sub muxes have an input selected the > + * decimator stays powered across the switch, so va_macro_enable_dec() > + * does not run and would leave ADC_DMIC_SEL on the previous domain. > + */ > + snd_soc_component_update_bits(component, mic_sel_reg, > + CDC_VA_TX_PATH_ADC_DMIC_SEL_MASK, > + val ? CDC_VA_TX_PATH_ADC_DMIC_SEL_ADC : > + CDC_VA_TX_PATH_ADC_DMIC_SEL_DMIC); > =20 > return snd_soc_dapm_put_enum_double(kcontrol, ucontrol); > } [Severity: Medium] Can an out-of-range enum value (val >=3D e->items) update mic_sel_reg in va_macro_put_dec_mux() and va_macro_put_dec_enum() before snd_soc_dapm_put_enum_double() validates item[0] and rejects the write with -EINVAL? When CONFIG_SND_CTL_INPUT_VALIDATION is disabled, snd_ctl_elem_write() leaves bounds checking to the put callback. If VA DECn MUX is set to 0 (VA_DMIC) and userspace writes an invalid index >=3D 2, va_macro_put_dec_mux() switches ADC_DMIC_SEL to ADC while snd_soc_dapm_put_enum_double() returns -EINVAL without updating CDC_VA_INP_MUX_ADC_MUXn_CFG1, leaving ADC_DMIC_SEL out of sync with the active mux state and breaking DMIC capture. Checking val >=3D e->items before updating mic_sel_reg (as tx_macro_put_dec_enum() does in lpass-tx-macro.c) would avoid this. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261201-add_shikra= _support-v8-0-5e56d0ad3810@oss.qualcomm.com?part=3D5