diff options
author | Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com> | 2020-12-10 18:25:41 +0300 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2020-12-11 16:23:00 +0300 |
commit | f5824e5ce1cdba523a357a4d3ffbe0876a27330f (patch) | |
tree | 398cc26597f816207364c82ff04c5e941f811c2d /sound | |
parent | 3759d5edc07598d55124d87bd292a95f79f47997 (diff) | |
download | linux-f5824e5ce1cdba523a357a4d3ffbe0876a27330f.tar.xz |
ASoC: topology: Add missing size check
When we parse "values" we perform check if there is correct number of
them. However similar check is missing in case of "texts", add it.
Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20201210152541.191728-2-amadeuszx.slawinski@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound')
-rw-r--r-- | sound/soc/soc-topology.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/sound/soc/soc-topology.c b/sound/soc/soc-topology.c index eb2633dd6454..e85b52798bc5 100644 --- a/sound/soc/soc-topology.c +++ b/sound/soc/soc-topology.c @@ -856,6 +856,9 @@ static int soc_tplg_denum_create_texts(struct soc_tplg *tplg, struct soc_enum *s { int i, ret; + if (le32_to_cpu(ec->items) > ARRAY_SIZE(ec->texts)) + return -EINVAL; + se->dobj.control.dtexts = devm_kcalloc(tplg->dev, le32_to_cpu(ec->items), sizeof(char *), GFP_KERNEL); if (se->dobj.control.dtexts == NULL) |