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>
This commit is contained in:
Amadeusz Sławiński 2020-12-10 10:25:41 -05:00 committed by Mark Brown
parent 3759d5edc0
commit f5824e5ce1
No known key found for this signature in database
GPG Key ID: 24D68B725D5487D0

View File

@ -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)