* [ammarfaizi2-block:broonie/sound/for-5.18 33/171] sound/soc/sof/compress.c:54 snd_sof_compr_fragment_elapsed() warn: variable dereferenced before check 'cstream' (see line 48)
@ 2022-03-11 18:59 ` Dan Carpenter
0 siblings, 0 replies; 5+ messages in thread
From: kernel test robot @ 2022-03-11 16:16 UTC (permalink / raw)
To: kbuild
[-- Attachment #1: Type: text/plain, Size: 3941 bytes --]
CC: kbuild-all(a)lists.01.org
BCC: lkp(a)intel.com
CC: "GNU/Weeb Mailing List" <gwml@vger.gnuweeb.org>
CC: linux-kernel(a)vger.kernel.org
TO: Daniel Baluta <daniel.baluta@nxp.com>
CC: Mark Brown <broonie@kernel.org>
tree: https://github.com/ammarfaizi2/linux-block broonie/sound/for-5.18
head: 6b6bb5e26222021abe1c5360f43b4c2ff1dd012f
commit: 6324cf901e14c6662be508f30485e0f09c54694d [33/171] ASoC: SOF: compr: Add compress ops implementation
:::::: branch date: 28 hours ago
:::::: commit date: 4 weeks ago
config: microblaze-randconfig-m031-20220310 (https://download.01.org/0day-ci/archive/20220312/202203120019.KjXsD7LN-lkp(a)intel.com/config)
compiler: microblaze-linux-gcc (GCC) 11.2.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
New smatch warnings:
sound/soc/sof/compress.c:54 snd_sof_compr_fragment_elapsed() warn: variable dereferenced before check 'cstream' (see line 48)
Old smatch warnings:
arch/microblaze/include/asm/thread_info.h:91 current_thread_info() error: uninitialized symbol 'sp'.
vim +/cstream +54 sound/soc/sof/compress.c
858f7a5c45cacb Daniel Baluta 2021-10-04 42
858f7a5c45cacb Daniel Baluta 2021-10-04 43 /*
858f7a5c45cacb Daniel Baluta 2021-10-04 44 * sof compr fragment elapse, this could be called in irq thread context
858f7a5c45cacb Daniel Baluta 2021-10-04 45 */
858f7a5c45cacb Daniel Baluta 2021-10-04 46 void snd_sof_compr_fragment_elapsed(struct snd_compr_stream *cstream)
858f7a5c45cacb Daniel Baluta 2021-10-04 47 {
6324cf901e14c6 Daniel Baluta 2022-01-20 @48 struct snd_soc_pcm_runtime *rtd = cstream->private_data;
6324cf901e14c6 Daniel Baluta 2022-01-20 49 struct snd_compr_runtime *crtd = cstream->runtime;
858f7a5c45cacb Daniel Baluta 2021-10-04 50 struct snd_soc_component *component;
6324cf901e14c6 Daniel Baluta 2022-01-20 51 struct snd_compr_tstamp *tstamp;
858f7a5c45cacb Daniel Baluta 2021-10-04 52 struct snd_sof_pcm *spcm;
858f7a5c45cacb Daniel Baluta 2021-10-04 53
858f7a5c45cacb Daniel Baluta 2021-10-04 @54 if (!cstream)
858f7a5c45cacb Daniel Baluta 2021-10-04 55 return;
858f7a5c45cacb Daniel Baluta 2021-10-04 56
6324cf901e14c6 Daniel Baluta 2022-01-20 57 tstamp = crtd->private_data;
858f7a5c45cacb Daniel Baluta 2021-10-04 58 component = snd_soc_rtdcom_lookup(rtd, SOF_AUDIO_PCM_DRV_NAME);
858f7a5c45cacb Daniel Baluta 2021-10-04 59
858f7a5c45cacb Daniel Baluta 2021-10-04 60 spcm = snd_sof_find_spcm_dai(component, rtd);
858f7a5c45cacb Daniel Baluta 2021-10-04 61 if (!spcm) {
858f7a5c45cacb Daniel Baluta 2021-10-04 62 dev_err(component->dev,
858f7a5c45cacb Daniel Baluta 2021-10-04 63 "fragment elapsed called for unknown stream!\n");
858f7a5c45cacb Daniel Baluta 2021-10-04 64 return;
858f7a5c45cacb Daniel Baluta 2021-10-04 65 }
858f7a5c45cacb Daniel Baluta 2021-10-04 66
6324cf901e14c6 Daniel Baluta 2022-01-20 67 sof_set_transferred_bytes(tstamp, spcm->stream[cstream->direction].posn.host_posn,
6324cf901e14c6 Daniel Baluta 2022-01-20 68 crtd->buffer_size);
6324cf901e14c6 Daniel Baluta 2022-01-20 69
858f7a5c45cacb Daniel Baluta 2021-10-04 70 /* use the same workqueue-based solution as for PCM, cf. snd_sof_pcm_elapsed */
858f7a5c45cacb Daniel Baluta 2021-10-04 71 schedule_work(&spcm->stream[cstream->direction].period_elapsed_work);
858f7a5c45cacb Daniel Baluta 2021-10-04 72 }
6324cf901e14c6 Daniel Baluta 2022-01-20 73
:::::: The code at line 54 was first introduced by commit
:::::: 858f7a5c45cacbf9965c4735330ee34baa0728f4 ASoC: SOF: Introduce fragment elapsed notification API
:::::: TO: Daniel Baluta <daniel.baluta@nxp.com>
:::::: CC: Mark Brown <broonie@kernel.org>
---
0-DAY CI Kernel Test Service
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
^ permalink raw reply [flat|nested] 5+ messages in thread
* [ammarfaizi2-block:broonie/sound/for-5.18 33/171] sound/soc/sof/compress.c:54 snd_sof_compr_fragment_elapsed() warn: variable dereferenced before check 'cstream' (see line 48)
@ 2022-03-11 18:59 ` Dan Carpenter
0 siblings, 0 replies; 5+ messages in thread
From: Dan Carpenter @ 2022-03-11 18:59 UTC (permalink / raw)
To: kbuild, Daniel Baluta
Cc: lkp, kbuild-all, GNU/Weeb Mailing List, linux-kernel, Mark Brown
tree: https://github.com/ammarfaizi2/linux-block broonie/sound/for-5.18
head: 6b6bb5e26222021abe1c5360f43b4c2ff1dd012f
commit: 6324cf901e14c6662be508f30485e0f09c54694d [33/171] ASoC: SOF: compr: Add compress ops implementation
config: microblaze-randconfig-m031-20220310 (https://download.01.org/0day-ci/archive/20220312/202203120019.KjXsD7LN-lkp@intel.com/config)
compiler: microblaze-linux-gcc (GCC) 11.2.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
New smatch warnings:
sound/soc/sof/compress.c:54 snd_sof_compr_fragment_elapsed() warn: variable dereferenced before check 'cstream' (see line 48)
vim +/cstream +54 sound/soc/sof/compress.c
858f7a5c45cacb Daniel Baluta 2021-10-04 46 void snd_sof_compr_fragment_elapsed(struct snd_compr_stream *cstream)
858f7a5c45cacb Daniel Baluta 2021-10-04 47 {
6324cf901e14c6 Daniel Baluta 2022-01-20 @48 struct snd_soc_pcm_runtime *rtd = cstream->private_data;
^^^^^^^^^^^^^^^^^^^^^^
6324cf901e14c6 Daniel Baluta 2022-01-20 49 struct snd_compr_runtime *crtd = cstream->runtime;
^^^^^^^^^^^^^^^^^
Dereference
858f7a5c45cacb Daniel Baluta 2021-10-04 50 struct snd_soc_component *component;
6324cf901e14c6 Daniel Baluta 2022-01-20 51 struct snd_compr_tstamp *tstamp;
858f7a5c45cacb Daniel Baluta 2021-10-04 52 struct snd_sof_pcm *spcm;
858f7a5c45cacb Daniel Baluta 2021-10-04 53
858f7a5c45cacb Daniel Baluta 2021-10-04 @54 if (!cstream)
^^^^^^^^
Checked too late
858f7a5c45cacb Daniel Baluta 2021-10-04 55 return;
858f7a5c45cacb Daniel Baluta 2021-10-04 56
6324cf901e14c6 Daniel Baluta 2022-01-20 57 tstamp = crtd->private_data;
858f7a5c45cacb Daniel Baluta 2021-10-04 58 component = snd_soc_rtdcom_lookup(rtd, SOF_AUDIO_PCM_DRV_NAME);
858f7a5c45cacb Daniel Baluta 2021-10-04 59
858f7a5c45cacb Daniel Baluta 2021-10-04 60 spcm = snd_sof_find_spcm_dai(component, rtd);
858f7a5c45cacb Daniel Baluta 2021-10-04 61 if (!spcm) {
858f7a5c45cacb Daniel Baluta 2021-10-04 62 dev_err(component->dev,
858f7a5c45cacb Daniel Baluta 2021-10-04 63 "fragment elapsed called for unknown stream!\n");
858f7a5c45cacb Daniel Baluta 2021-10-04 64 return;
858f7a5c45cacb Daniel Baluta 2021-10-04 65 }
858f7a5c45cacb Daniel Baluta 2021-10-04 66
6324cf901e14c6 Daniel Baluta 2022-01-20 67 sof_set_transferred_bytes(tstamp, spcm->stream[cstream->direction].posn.host_posn,
6324cf901e14c6 Daniel Baluta 2022-01-20 68 crtd->buffer_size);
6324cf901e14c6 Daniel Baluta 2022-01-20 69
858f7a5c45cacb Daniel Baluta 2021-10-04 70 /* use the same workqueue-based solution as for PCM, cf. snd_sof_pcm_elapsed */
858f7a5c45cacb Daniel Baluta 2021-10-04 71 schedule_work(&spcm->stream[cstream->direction].period_elapsed_work);
858f7a5c45cacb Daniel Baluta 2021-10-04 72 }
---
0-DAY CI Kernel Test Service
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
^ permalink raw reply [flat|nested] 5+ messages in thread
* [ammarfaizi2-block:broonie/sound/for-5.18 33/171] sound/soc/sof/compress.c:54 snd_sof_compr_fragment_elapsed() warn: variable dereferenced before check 'cstream' (see line 48)
@ 2022-03-11 18:59 ` Dan Carpenter
0 siblings, 0 replies; 5+ messages in thread
From: Dan Carpenter @ 2022-03-11 18:59 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 3256 bytes --]
tree: https://github.com/ammarfaizi2/linux-block broonie/sound/for-5.18
head: 6b6bb5e26222021abe1c5360f43b4c2ff1dd012f
commit: 6324cf901e14c6662be508f30485e0f09c54694d [33/171] ASoC: SOF: compr: Add compress ops implementation
config: microblaze-randconfig-m031-20220310 (https://download.01.org/0day-ci/archive/20220312/202203120019.KjXsD7LN-lkp(a)intel.com/config)
compiler: microblaze-linux-gcc (GCC) 11.2.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
New smatch warnings:
sound/soc/sof/compress.c:54 snd_sof_compr_fragment_elapsed() warn: variable dereferenced before check 'cstream' (see line 48)
vim +/cstream +54 sound/soc/sof/compress.c
858f7a5c45cacb Daniel Baluta 2021-10-04 46 void snd_sof_compr_fragment_elapsed(struct snd_compr_stream *cstream)
858f7a5c45cacb Daniel Baluta 2021-10-04 47 {
6324cf901e14c6 Daniel Baluta 2022-01-20 @48 struct snd_soc_pcm_runtime *rtd = cstream->private_data;
^^^^^^^^^^^^^^^^^^^^^^
6324cf901e14c6 Daniel Baluta 2022-01-20 49 struct snd_compr_runtime *crtd = cstream->runtime;
^^^^^^^^^^^^^^^^^
Dereference
858f7a5c45cacb Daniel Baluta 2021-10-04 50 struct snd_soc_component *component;
6324cf901e14c6 Daniel Baluta 2022-01-20 51 struct snd_compr_tstamp *tstamp;
858f7a5c45cacb Daniel Baluta 2021-10-04 52 struct snd_sof_pcm *spcm;
858f7a5c45cacb Daniel Baluta 2021-10-04 53
858f7a5c45cacb Daniel Baluta 2021-10-04 @54 if (!cstream)
^^^^^^^^
Checked too late
858f7a5c45cacb Daniel Baluta 2021-10-04 55 return;
858f7a5c45cacb Daniel Baluta 2021-10-04 56
6324cf901e14c6 Daniel Baluta 2022-01-20 57 tstamp = crtd->private_data;
858f7a5c45cacb Daniel Baluta 2021-10-04 58 component = snd_soc_rtdcom_lookup(rtd, SOF_AUDIO_PCM_DRV_NAME);
858f7a5c45cacb Daniel Baluta 2021-10-04 59
858f7a5c45cacb Daniel Baluta 2021-10-04 60 spcm = snd_sof_find_spcm_dai(component, rtd);
858f7a5c45cacb Daniel Baluta 2021-10-04 61 if (!spcm) {
858f7a5c45cacb Daniel Baluta 2021-10-04 62 dev_err(component->dev,
858f7a5c45cacb Daniel Baluta 2021-10-04 63 "fragment elapsed called for unknown stream!\n");
858f7a5c45cacb Daniel Baluta 2021-10-04 64 return;
858f7a5c45cacb Daniel Baluta 2021-10-04 65 }
858f7a5c45cacb Daniel Baluta 2021-10-04 66
6324cf901e14c6 Daniel Baluta 2022-01-20 67 sof_set_transferred_bytes(tstamp, spcm->stream[cstream->direction].posn.host_posn,
6324cf901e14c6 Daniel Baluta 2022-01-20 68 crtd->buffer_size);
6324cf901e14c6 Daniel Baluta 2022-01-20 69
858f7a5c45cacb Daniel Baluta 2021-10-04 70 /* use the same workqueue-based solution as for PCM, cf. snd_sof_pcm_elapsed */
858f7a5c45cacb Daniel Baluta 2021-10-04 71 schedule_work(&spcm->stream[cstream->direction].period_elapsed_work);
858f7a5c45cacb Daniel Baluta 2021-10-04 72 }
---
0-DAY CI Kernel Test Service
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [ammarfaizi2-block:broonie/sound/for-5.18 33/171] sound/soc/sof/compress.c:54 snd_sof_compr_fragment_elapsed() warn: variable dereferenced before check 'cstream' (see line 48)
2022-03-11 18:59 ` Dan Carpenter
@ 2022-03-11 22:41 ` Ammar Faizi
-1 siblings, 0 replies; 5+ messages in thread
From: Ammar Faizi @ 2022-03-11 22:41 UTC (permalink / raw)
To: Dan Carpenter, kbuild, Daniel Baluta
Cc: lkp, kbuild-all, GNU/Weeb Mailing List, linux-kernel, Mark Brown
On 3/12/22 1:59 AM, Dan Carpenter wrote:
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot <lkp@intel.com>
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
>
> New smatch warnings:
> sound/soc/sof/compress.c:54 snd_sof_compr_fragment_elapsed() warn: variable dereferenced before check 'cstream' (see line 48)
>
> vim +/cstream +54 sound/soc/sof/compress.c
>
> 858f7a5c45cacb Daniel Baluta 2021-10-04 46 void snd_sof_compr_fragment_elapsed(struct snd_compr_stream *cstream)
> 858f7a5c45cacb Daniel Baluta 2021-10-04 47 {
> 6324cf901e14c6 Daniel Baluta 2022-01-20 @48 struct snd_soc_pcm_runtime *rtd = cstream->private_data;
> ^^^^^^^^^^^^^^^^^^^^^^
> 6324cf901e14c6 Daniel Baluta 2022-01-20 49 struct snd_compr_runtime *crtd = cstream->runtime;
> ^^^^^^^^^^^^^^^^^
> Dereference
>
> 858f7a5c45cacb Daniel Baluta 2021-10-04 50 struct snd_soc_component *component;
> 6324cf901e14c6 Daniel Baluta 2022-01-20 51 struct snd_compr_tstamp *tstamp;
> 858f7a5c45cacb Daniel Baluta 2021-10-04 52 struct snd_sof_pcm *spcm;
> 858f7a5c45cacb Daniel Baluta 2021-10-04 53
> 858f7a5c45cacb Daniel Baluta 2021-10-04 @54 if (!cstream)
> ^^^^^^^^
> Checked too late
Hi Dan,
Thanks for reporting, it has already been fixed in commit
7e4bfcf10a03981 ("ASoC: SOF: compress: fix null check after dereference")
Link: https://git.kernel.org/broonie/sound/c/7e4bfcf10a03981
Regards,
--
Ammar Faizi
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [ammarfaizi2-block:broonie/sound/for-5.18 33/171] sound/soc/sof/compress.c:54 snd_sof_compr_fragment_elapsed() warn: variable dereferenced before check 'cstream' (see line 48)
@ 2022-03-11 22:41 ` Ammar Faizi
0 siblings, 0 replies; 5+ messages in thread
From: Ammar Faizi @ 2022-03-11 22:41 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 1719 bytes --]
On 3/12/22 1:59 AM, Dan Carpenter wrote:
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot <lkp@intel.com>
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
>
> New smatch warnings:
> sound/soc/sof/compress.c:54 snd_sof_compr_fragment_elapsed() warn: variable dereferenced before check 'cstream' (see line 48)
>
> vim +/cstream +54 sound/soc/sof/compress.c
>
> 858f7a5c45cacb Daniel Baluta 2021-10-04 46 void snd_sof_compr_fragment_elapsed(struct snd_compr_stream *cstream)
> 858f7a5c45cacb Daniel Baluta 2021-10-04 47 {
> 6324cf901e14c6 Daniel Baluta 2022-01-20 @48 struct snd_soc_pcm_runtime *rtd = cstream->private_data;
> ^^^^^^^^^^^^^^^^^^^^^^
> 6324cf901e14c6 Daniel Baluta 2022-01-20 49 struct snd_compr_runtime *crtd = cstream->runtime;
> ^^^^^^^^^^^^^^^^^
> Dereference
>
> 858f7a5c45cacb Daniel Baluta 2021-10-04 50 struct snd_soc_component *component;
> 6324cf901e14c6 Daniel Baluta 2022-01-20 51 struct snd_compr_tstamp *tstamp;
> 858f7a5c45cacb Daniel Baluta 2021-10-04 52 struct snd_sof_pcm *spcm;
> 858f7a5c45cacb Daniel Baluta 2021-10-04 53
> 858f7a5c45cacb Daniel Baluta 2021-10-04 @54 if (!cstream)
> ^^^^^^^^
> Checked too late
Hi Dan,
Thanks for reporting, it has already been fixed in commit
7e4bfcf10a03981 ("ASoC: SOF: compress: fix null check after dereference")
Link: https://git.kernel.org/broonie/sound/c/7e4bfcf10a03981
Regards,
--
Ammar Faizi
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2022-03-11 22:54 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-11 16:16 [ammarfaizi2-block:broonie/sound/for-5.18 33/171] sound/soc/sof/compress.c:54 snd_sof_compr_fragment_elapsed() warn: variable dereferenced before check 'cstream' (see line 48) kernel test robot
2022-03-11 18:59 ` Dan Carpenter
2022-03-11 18:59 ` Dan Carpenter
2022-03-11 22:41 ` Ammar Faizi
2022-03-11 22:41 ` Ammar Faizi
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.