未验证 提交 7e4bfcf1 编写于 作者: 因上努力果上随缘's avatar 因上努力果上随缘 提交者: Mark Brown

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: NRanjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: NDaniel Baluta <daniel.baluta@nxp.com>
Reviewed-by: NPéter Ujfalusi <peter.ujfalusi@linux.intel.com>
Signed-off-by: 因上努力果上随缘's avatarWeiguo Li <liwg06@foxmail.com>
Signed-off-by: NPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20220310171651.249385-3-pierre-louis.bossart@linux.intel.comSigned-off-by: NMark Brown <broonie@kernel.org>
上级 a174e72e
...@@ -46,8 +46,8 @@ void snd_sof_compr_init_elapsed_work(struct work_struct *work) ...@@ -46,8 +46,8 @@ void snd_sof_compr_init_elapsed_work(struct work_struct *work)
*/ */
void snd_sof_compr_fragment_elapsed(struct snd_compr_stream *cstream) void snd_sof_compr_fragment_elapsed(struct snd_compr_stream *cstream)
{ {
struct snd_soc_pcm_runtime *rtd = cstream->private_data; struct snd_soc_pcm_runtime *rtd;
struct snd_compr_runtime *crtd = cstream->runtime; struct snd_compr_runtime *crtd;
struct snd_soc_component *component; struct snd_soc_component *component;
struct snd_compr_tstamp *tstamp; struct snd_compr_tstamp *tstamp;
struct snd_sof_pcm *spcm; struct snd_sof_pcm *spcm;
...@@ -55,6 +55,8 @@ void snd_sof_compr_fragment_elapsed(struct snd_compr_stream *cstream) ...@@ -55,6 +55,8 @@ void snd_sof_compr_fragment_elapsed(struct snd_compr_stream *cstream)
if (!cstream) if (!cstream)
return; return;
rtd = cstream->private_data;
crtd = cstream->runtime;
tstamp = crtd->private_data; tstamp = crtd->private_data;
component = snd_soc_rtdcom_lookup(rtd, SOF_AUDIO_PCM_DRV_NAME); component = snd_soc_rtdcom_lookup(rtd, SOF_AUDIO_PCM_DRV_NAME);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册