lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <202203120019.KjXsD7LN-lkp@intel.com>
Date:   Fri, 11 Mar 2022 21:59:17 +0300
From:   Dan Carpenter <dan.carpenter@...cle.com>
To:     kbuild@...ts.01.org, Daniel Baluta <daniel.baluta@....com>
Cc:     lkp@...el.com, kbuild-all@...ts.01.org,
        GNU/Weeb Mailing List <gwml@...r.gnuweeb.org>,
        linux-kernel@...r.kernel.org, Mark Brown <broonie@...nel.org>
Subject: [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)

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@...el.com>
Reported-by: Dan Carpenter <dan.carpenter@...cle.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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ