aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc
diff options
context:
space:
mode:
authorAmadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>2020-12-10 10:25:41 -0500
committerMark Brown <broonie@kernel.org>2020-12-11 13:23:00 +0000
commitf5824e5ce1cdba523a357a4d3ffbe0876a27330f (patch)
tree398cc26597f816207364c82ff04c5e941f811c2d /sound/soc
parentdt-bindings: tegra: Add missing HDA properties (diff)
downloadlinux-dev-f5824e5ce1cdba523a357a4d3ffbe0876a27330f.tar.xz
linux-dev-f5824e5ce1cdba523a357a4d3ffbe0876a27330f.zip
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/soc')
-rw-r--r--sound/soc/soc-topology.c3
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)