[alsa-devel] [asoc:for-5.2 101/107] sound/soc/sprd/sprd-pcm-compress.c:110 sprd_platform_compr_drain_notify() warn: variable dereferenced before check 'cstream' (see line 105)
Baolin Wang
baolin.wang at linaro.org
Wed Apr 3 08:52:01 CEST 2019
On Wed, 3 Apr 2019 at 14:46, Dan Carpenter <dan.carpenter at oracle.com> wrote:
>
> tree: https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-5.2
> head: 6d5e2bf9d203e4d9e08ca2e9420c6ff22ad190af
> commit: cce1396936ef2b347d622b4d49718818eb32029d [101/107] ASoC: sprd: Add Spreadtrum audio compress offload support
>
> smatch warnings:
> sound/soc/sprd/sprd-pcm-compress.c:110 sprd_platform_compr_drain_notify() warn: variable dereferenced before check 'cstream' (see line 105)
>
> # https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git/commit/?id=cce1396936ef2b347d622b4d49718818eb32029d
> git remote add asoc https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git
> git remote update asoc
> git checkout cce1396936ef2b347d622b4d49718818eb32029d
> vim +/cstream +110 sound/soc/sprd/sprd-pcm-compress.c
>
> cce13969 Baolin Wang 2019-03-27 98
> cce13969 Baolin Wang 2019-03-27 99 static int sprd_platform_compr_trigger(struct snd_compr_stream *cstream,
> cce13969 Baolin Wang 2019-03-27 100 int cmd);
> cce13969 Baolin Wang 2019-03-27 101
> cce13969 Baolin Wang 2019-03-27 102 static void sprd_platform_compr_drain_notify(void *arg)
> cce13969 Baolin Wang 2019-03-27 103 {
> cce13969 Baolin Wang 2019-03-27 104 struct snd_compr_stream *cstream = arg;
> cce13969 Baolin Wang 2019-03-27 @105 struct snd_compr_runtime *runtime = cstream->runtime;
> ^^^^^^^^^^^^^^^^
>
> cce13969 Baolin Wang 2019-03-27 106 struct sprd_compr_stream *stream = runtime->private_data;
> cce13969 Baolin Wang 2019-03-27 107
> cce13969 Baolin Wang 2019-03-27 108 memset(stream->info_area, 0, sizeof(struct sprd_compr_playinfo));
> cce13969 Baolin Wang 2019-03-27 109
> cce13969 Baolin Wang 2019-03-27 @110 if (cstream)
> ^^^^^^^
Sorry for my mistake. It seems no need to validate the cstream
variable here. Will fix it. Thanks.
--
Baolin Wang
Best Regards
More information about the Alsa-devel
mailing list