[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20241106055720.208057-1-luoyifan@cmss.chinamobile.com>
Date: Wed, 6 Nov 2024 13:57:20 +0800
From: Luo Yifan <luoyifan@...s.chinamobile.com>
To: lgirdwood@...il.com,
broonie@...nel.org,
perex@...ex.cz,
tiwai@...e.com
Cc: linux-sound@...r.kernel.org,
linux-kernel@...r.kernel.org,
Luo Yifan <luoyifan@...s.chinamobile.com>
Subject: [PATCH] ASoC: amd: acp: Fix potential null pointer dereference of "adata"
The condition `!adata` indicates a possible null pointer dereference
for the "adata" parameter. To address this, the access to "adata"
members has been moved after the null check to ensure safer handling.
Signed-off-by: Luo Yifan <luoyifan@...s.chinamobile.com>
---
sound/soc/amd/acp/acp-platform.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/sound/soc/amd/acp/acp-platform.c b/sound/soc/amd/acp/acp-platform.c
index 3a7a467b7..2acb08073 100644
--- a/sound/soc/amd/acp/acp-platform.c
+++ b/sound/soc/amd/acp/acp-platform.c
@@ -137,7 +137,7 @@ EXPORT_SYMBOL_NS_GPL(acp_machine_select, SND_SOC_ACP_COMMON);
static irqreturn_t i2s_irq_handler(int irq, void *data)
{
struct acp_dev_data *adata = data;
- struct acp_resource *rsrc = adata->rsrc;
+ struct acp_resource *rsrc;
struct acp_stream *stream;
u16 i2s_flag = 0;
u32 ext_intr_stat, ext_intr_stat1;
@@ -145,6 +145,8 @@ static irqreturn_t i2s_irq_handler(int irq, void *data)
if (!adata)
return IRQ_NONE;
+ rsrc = adata->rsrc;
+
if (adata->rsrc->no_of_ctrls == 2)
ext_intr_stat1 = readl(ACP_EXTERNAL_INTR_STAT(adata, (rsrc->irqp_used - 1)));
--
2.27.0
Powered by blists - more mailing lists