提交 19d7f578 编写于 作者: D Dan Carpenter 提交者: Zheng Zengkai

ASoC: topology: Fix memory corruption in soc_tplg_denum_create_values()

stable inclusion
from stable-5.10.13
commit 1e3a8d94dd6b7e7571c276aeaa89bf643905f079
bugzilla: 47995

--------------------------------

commit 543466ef 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: 5aebe7c7 ("ASoC: topology: fix endianness issues")
Signed-off-by: NDan Carpenter <dan.carpenter@oracle.com>
Link: https://lore.kernel.org/r/YAf+8QZoOv+ct526@mwandaSigned-off-by: NMark Brown <broonie@kernel.org>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
Acked-by: NXie XiuQi <xiexiuqi@huawei.com>
上级 57511976
......@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册