summaryrefslogtreecommitdiffstats
path: root/sound/soc/soc-topology.c
diff options
context:
space:
mode:
authorLiam Girdwood <liam.r.girdwood@linux.intel.com>2018-03-27 14:30:44 +0100
committerMark Brown <broonie@kernel.org>2018-04-17 18:06:54 +0100
commitf53c4c20d6d38bcefd89bfcab135486cbb797884 (patch)
tree91cac6961fc03936104a64b610b70a29bc8fa88f /sound/soc/soc-topology.c
parentfeb12f0cd8d7b1e8df2e6fce19fc9a026a468cc2 (diff)
downloadtalos-obmc-linux-f53c4c20d6d38bcefd89bfcab135486cbb797884.tar.gz
talos-obmc-linux-f53c4c20d6d38bcefd89bfcab135486cbb797884.zip
ASoC: topology: Check widget kcontrols before deref
Validate the topology input before we dereference the pointer. Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com> Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/soc-topology.c')
-rw-r--r--sound/soc/soc-topology.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sound/soc/soc-topology.c b/sound/soc/soc-topology.c
index 5598e891b2b3..986b8b2f90fb 100644
--- a/sound/soc/soc-topology.c
+++ b/sound/soc/soc-topology.c
@@ -513,7 +513,7 @@ static void remove_widget(struct snd_soc_component *comp,
*/
if (dobj->widget.kcontrol_type == SND_SOC_TPLG_TYPE_ENUM) {
/* enumerated widget mixer */
- for (i = 0; i < w->num_kcontrols; i++) {
+ for (i = 0; w->kcontrols != NULL && i < w->num_kcontrols; i++) {
struct snd_kcontrol *kcontrol = w->kcontrols[i];
struct soc_enum *se =
(struct soc_enum *)kcontrol->private_value;
@@ -530,7 +530,7 @@ static void remove_widget(struct snd_soc_component *comp,
}
} else {
/* volume mixer or bytes controls */
- for (i = 0; i < w->num_kcontrols; i++) {
+ for (i = 0; w->kcontrols != NULL && i < w->num_kcontrols; i++) {
struct snd_kcontrol *kcontrol = w->kcontrols[i];
if (dobj->widget.kcontrol_type
OpenPOWER on IntegriCloud