Message ID | 20201210152541.191728-2-amadeuszx.slawinski@linux.intel.com (mailing list archive) |
---|---|
State | Accepted |
Commit | f5824e5ce1cdba523a357a4d3ffbe0876a27330f |
Headers | show |
Series | [1/2] ASoC: topology: Fix wrong size check | expand |
On Thu, 2020-12-10 at 10:25 -0500, Amadeusz Sławiński wrote: > 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> Both patches look good, Amadeusz! Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
diff --git a/sound/soc/soc-topology.c b/sound/soc/soc-topology.c index 7fb3a87ab860..950c45008e24 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)
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> --- sound/soc/soc-topology.c | 3 +++ 1 file changed, 3 insertions(+)