summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2021-01-20 12:59:13 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-02-03 23:28:51 +0100
commit1e3a8d94dd6b7e7571c276aeaa89bf643905f079 (patch)
tree04fc63652bffb8a06ec2f46d8a30f276c4ae3643
parent4a97f42a6690ea8b81c4b17bc422934dfd505821 (diff)
ASoC: topology: Fix memory corruption in soc_tplg_denum_create_values()
commit 543466ef3571069b8eb13a8ff7c7cfc8d8a75c43 upstream. The allocation uses sizeof(u32) when it should use sizeof(unsigned long) so it leads to memory corruption later in the function when the data is initialized. Fixes: 5aebe7c7f9c2 ("ASoC: topology: fix endianness issues") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Link: https://lore.kernel.org/r/YAf+8QZoOv+ct526@mwanda Signed-off-by: Mark Brown <broonie@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--sound/soc/soc-topology.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/sound/soc/soc-topology.c b/sound/soc/soc-topology.c
index 42e1a9beaf3f..1030e11017b2 100644
--- a/sound/soc/soc-topology.c
+++ b/sound/soc/soc-topology.c
@@ -987,7 +987,7 @@ static int soc_tplg_denum_create_values(struct soc_enum *se,
return -EINVAL;
se->dobj.control.dvalues = kzalloc(le32_to_cpu(ec->items) *
- sizeof(u32),
+ sizeof(*se->dobj.control.dvalues),
GFP_KERNEL);
if (!se->dobj.control.dvalues)
return -ENOMEM;