From: sashiko-bot@kernel.org
To: "Prasad Kumpatla" <prasad.kumpatla@oss.qualcomm.com>
Cc: robh@kernel.org, devicetree@vger.kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH v7 1/7] ASoC: qcom: qdsp6: add topology-driven Audio IF support
Date: Tue, 04 Aug 2026 07:16:39 +0000 [thread overview]
Message-ID: <20260804071639.B71521F00A3A@smtp.kernel.org> (raw)
In-Reply-To: <20260804070307.117119-2-prasad.kumpatla@oss.qualcomm.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Uninitialized stack memory is used to configure the DSP, which can lead to unpredictable behavior or DSP crashes.
--
--- Patch [1]: [PATCH v7 1/7] ASoC: qcom: qdsp6: add topology-driven Audio IF support ---
commit 0fae44a436543afc97061ba27a78d9bfd55821bf
Author: Prasad Kumpatla <prasad.kumpatla@oss.qualcomm.com>
ASoC: qcom: qdsp6: add topology-driven Audio IF support
Add topology parsing and media-format programming for Audio IF source and
sink modules. This introduces new Audio IF module IDs, required topology
tokens, and the media-format path to send interface configuration to the DSP.
> diff --git a/sound/soc/qcom/qdsp6/audioreach.c b/sound/soc/qcom/qdsp6/audioreach.c
> index 0cc840aca69dd..cce0ad31ff0c0 100644
> --- a/sound/soc/qcom/qdsp6/audioreach.c
> +++ b/sound/soc/qcom/qdsp6/audioreach.c
[ ... ]
> @@ -1052,6 +1066,81 @@ static int audioreach_i2s_set_media_format(struct q6apm_graph *graph,
> return q6apm_send_cmd_sync(graph->apm, pkt, 0);
> }
>
> +static int audioreach_audio_if_set_media_format(struct q6apm_graph *graph,
> + const struct audioreach_module *module,
> + const struct audioreach_module_config *cfg)
> +{
> + struct apm_module_hw_ep_frame_duration_cfg *fd_cfg;
> + struct apm_module_param_data *param_data;
> + struct apm_audio_if_module_intf_cfg *intf_cfg;
> + struct apm_module_hw_ep_mf_cfg *hw_cfg;
> + int ic_sz = APM_AUDIO_IF_INTF_CFG_PSIZE;
> + int ep_sz = APM_HW_EP_CFG_PSIZE;
> + int fd_sz = APM_HW_EP_FRAME_DURATION_PSIZE;
> + int size = ic_sz + ep_sz + fd_sz;
> + u32 slot_mask = cfg->slot_mask ? cfg->slot_mask : module->slot_mask;
> + u16 nslots_per_frame = cfg->nslots_per_frame ?
> + (u16)cfg->nslots_per_frame : module->nslots_per_frame;
> + u16 slot_width = cfg->slot_width ? (u16)cfg->slot_width : module->slot_width;
[Severity: High]
Could this lead to sending garbage configuration parameters to the DSP?
Callers of audioreach_set_media_format() (like q6apm_dai_prepare() in
q6apm-dai.c) allocate `struct audioreach_module_config cfg` on the stack
without zero-initializing it.
Since callers generally only populate specific fields for their own needs,
the newly added fields (slot_mask, nslots_per_frame, and slot_width) will
often contain uninitialized stack memory.
Because the ternary operators here fall back to the module defaults only if
the config fields are exactly zero, this stack garbage will frequently evaluate
as true. This overrides the valid topology configuration and sends malformed
interface parameters to the DSP, which might cause audio path failures or
DSP crashes.
> + void *p;
> +
> + struct gpr_pkt *pkt __free(kfree) = audioreach_alloc_apm_cmd_pkt(size, APM_CMD_SET_CFG, 0);
> + if (IS_ERR(pkt))
> + return PTR_ERR(pkt);
[ ... ]
> diff --git a/sound/soc/qcom/qdsp6/audioreach.h b/sound/soc/qcom/qdsp6/audioreach.h
> index 62a2fd79bbcb9..35541b2d8c998 100644
> --- a/sound/soc/qcom/qdsp6/audioreach.h
> +++ b/sound/soc/qcom/qdsp6/audioreach.h
[ ... ]
> @@ -907,6 +994,9 @@ struct audioreach_module_config {
> u32 channel_allocation;
> u32 sd_line_mask;
> int fmt;
> + u32 slot_mask;
> + u16 nslots_per_frame;
> + u16 slot_width;
> struct snd_codec codec;
> u8 channel_map[AR_PCM_MAX_NUM_CHANNEL];
> };
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260804070307.117119-1-prasad.kumpatla@oss.qualcomm.com?part=1
next prev parent reply other threads:[~2026-08-04 7:16 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-04 7:03 [PATCH v7 0/7] ASoC: qcom: add AudioReach TDM backend support Prasad Kumpatla
2026-08-04 7:03 ` [PATCH v7 1/7] ASoC: qcom: qdsp6: add topology-driven Audio IF support Prasad Kumpatla
2026-08-04 7:16 ` sashiko-bot [this message]
2026-08-04 17:46 ` Cezary Rojewski
2026-08-04 17:50 ` Mark Brown
2026-08-04 17:58 ` Cezary Rojewski
2026-08-04 7:03 ` [PATCH v7 2/7] ASoC: qcom: q6apm-lpass-dais: add TDM DAI operations Prasad Kumpatla
2026-08-04 7:03 ` [PATCH v7 3/7] dt-bindings: sound: qcom,q6dsp-lpass-ports: add Audio IF clocks Prasad Kumpatla
2026-08-04 7:08 ` sashiko-bot
2026-08-04 20:16 ` Rob Herring
2026-08-05 4:40 ` Prasad Kumpatla
2026-08-05 6:10 ` Krzysztof Kozlowski
2026-08-05 6:29 ` Prasad Kumpatla
2026-08-05 6:33 ` Krzysztof Kozlowski
2026-08-05 6:36 ` Krzysztof Kozlowski
2026-08-05 6:50 ` Prasad Kumpatla
2026-08-04 7:03 ` [PATCH v7 4/7] ASoC: qcom: q6prm: add Audio IF clock IDs Prasad Kumpatla
2026-08-04 7:11 ` sashiko-bot
2026-08-04 7:03 ` [PATCH v7 5/7] dt-bindings: sound: qcom,sm8250: allow TDM slot properties Prasad Kumpatla
2026-08-04 7:17 ` sashiko-bot
2026-08-04 7:03 ` [PATCH v7 6/7] ASoC: qcom: common: add DAI-node TDM slot helpers Prasad Kumpatla
2026-08-04 7:18 ` sashiko-bot
2026-08-04 7:03 ` [PATCH v7 7/7] ASoC: qcom: sc8280xp: add TDM hw_params support Prasad Kumpatla
2026-08-04 7:23 ` sashiko-bot
2026-08-04 16:32 ` [PATCH v7 0/7] ASoC: qcom: add AudioReach TDM backend support Mark Brown
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=20260804071639.B71521F00A3A@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=prasad.kumpatla@oss.qualcomm.com \
--cc=robh@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/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