From: Dan Carpenter Date: Wed, 20 Jan 2021 09:59:13 +0000 (+0300) Subject: ASoC: topology: Fix memory corruption in soc_tplg_denum_create_values() X-Git-Tag: v5.4.95~3 X-Git-Url: https://git.fsl.cs.sunysb.edu/?a=commitdiff_plain;h=489e35c6829a56ae0e863a5ab6a4a34c7edc024f;p=wrapfs-5.3.y.git 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 Link: https://lore.kernel.org/r/YAf+8QZoOv+ct526@mwanda Signed-off-by: Mark Brown Signed-off-by: Greg Kroah-Hartman --- diff --git a/sound/soc/soc-topology.c b/sound/soc/soc-topology.c index 0100f123484e..c367609433bf 100644 --- a/sound/soc/soc-topology.c +++ b/sound/soc/soc-topology.c @@ -982,7 +982,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;