Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ASoC: SOF: topology: fix missing NULL pointer check

Add check to avoid possible NULL pointer dereference issue.

This issue was reported by static analysis tools, we didn't face this
issue but we can't rule it out either as a false positive.

Reported-by: Keqiao Zhang <keqiao.zhang@intel.com>
Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20191101170916.26517-2-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Keyon Jie and committed by
Mark Brown
8cd73ce7 bd0b609e

+5
+5
sound/soc/sof/topology.c
··· 150 150 151 151 /* get runtime PCM params using widget's stream name */ 152 152 spcm = snd_sof_find_spcm_name(sdev, swidget->widget->sname); 153 + if (!spcm) { 154 + dev_err(sdev->dev, "error: cannot find PCM for %s\n", 155 + swidget->widget->name); 156 + return -EINVAL; 157 + } 153 158 154 159 /* process events */ 155 160 switch (event) {