]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
ASoC: topology: Fix memory corruption in soc_tplg_denum_create_values()
authorDan Carpenter <dan.carpenter@oracle.com>
Wed, 20 Jan 2021 09:59:13 +0000 (12:59 +0300)
committerMark Brown <broonie@kernel.org>
Wed, 20 Jan 2021 16:46:48 +0000 (16:46 +0000)
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>
sound/soc/soc-topology.c

index 950c45008e245fbf2952bff0f9c986c95d40a8a3..37a5d73e643b8b33f1f8662e3e8a1146e67314eb 100644 (file)
@@ -902,7 +902,7 @@ static int soc_tplg_denum_create_values(struct soc_tplg *tplg, struct soc_enum *
                return -EINVAL;
 
        se->dobj.control.dvalues = devm_kcalloc(tplg->dev, le32_to_cpu(ec->items),
-                                          sizeof(u32),
+                                          sizeof(*se->dobj.control.dvalues),
                                           GFP_KERNEL);
        if (!se->dobj.control.dvalues)
                return -ENOMEM;