Skip to content

Commit 7e4bfcf

Browse files
liwg06broonie
authored andcommitted
ASoC: SOF: compress: fix null check after dereference
"cstream" is dereferenced but null checked later. Swap their positions to avoid potential null dereference. Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com> Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com> Signed-off-by: Weiguo Li <liwg06@foxmail.com> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Link: https://lore.kernel.org/r/20220310171651.249385-3-pierre-louis.bossart@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent a174e72 commit 7e4bfcf

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

sound/soc/sof/compress.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,17 @@ void snd_sof_compr_init_elapsed_work(struct work_struct *work)
4646
*/
4747
void snd_sof_compr_fragment_elapsed(struct snd_compr_stream *cstream)
4848
{
49-
struct snd_soc_pcm_runtime *rtd = cstream->private_data;
50-
struct snd_compr_runtime *crtd = cstream->runtime;
49+
struct snd_soc_pcm_runtime *rtd;
50+
struct snd_compr_runtime *crtd;
5151
struct snd_soc_component *component;
5252
struct snd_compr_tstamp *tstamp;
5353
struct snd_sof_pcm *spcm;
5454

5555
if (!cstream)
5656
return;
5757

58+
rtd = cstream->private_data;
59+
crtd = cstream->runtime;
5860
tstamp = crtd->private_data;
5961
component = snd_soc_rtdcom_lookup(rtd, SOF_AUDIO_PCM_DRV_NAME);
6062

0 commit comments

Comments
 (0)