[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200426222050.GA28661@Asurada-Nvidia>
Date: Sun, 26 Apr 2020 15:20:51 -0700
From: Nicolin Chen <nicoleotsuka@...il.com>
To: Shengjiu Wang <shengjiu.wang@....com>
Cc: timur@...nel.org, Xiubo.Lee@...il.com, festevam@...il.com,
broonie@...nel.org, alsa-devel@...a-project.org,
lgirdwood@...il.com, perex@...ex.cz, tiwai@...e.com,
linuxppc-dev@...ts.ozlabs.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2] ASoC: fsl_easrc: Check for null pointer before
dereferencing "ctx" in fsl_easrc_hw_free()
On Sat, Apr 25, 2020 at 03:19:29PM +0800, Shengjiu Wang wrote:
> The patch 955ac624058f: "ASoC: fsl_easrc: Add EASRC ASoC CPU DAI
> drivers" from Apr 16, 2020, leads to the following Smatch complaint:
>
> sound/soc/fsl/fsl_easrc.c:1529 fsl_easrc_hw_free()
> warn: variable dereferenced before check 'ctx' (see line 1527)
>
> sound/soc/fsl/fsl_easrc.c
> 1526 struct fsl_asrc_pair *ctx = runtime->private_data;
> 1527 struct fsl_easrc_ctx_priv *ctx_priv = ctx->private;
> ^^^^^
> Dereference
>
> 1528
> 1529 if (ctx && (ctx_priv->ctx_streams & BIT(substream->stream))) {
> ^^^
> This check is too late, to prevent a NULL dereference.
>
> 1530 ctx_priv->ctx_streams &= ~BIT(substream->stream);
> 1531 fsl_easrc_release_context(ctx);
>
> Fixes: 955ac624058f ("ASoC: fsl_easrc: Add EASRC ASoC CPU DAI drivers")
> Reported-by: Dan Carpenter <dan.carpenter@...cle.com>
> Signed-off-by: Shengjiu Wang <shengjiu.wang@....com>
Acked-by: Nicolin Chen <nicoleotsuka@...il.com>
Powered by blists - more mailing lists