Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

ASoC: SOF: topology: Use krealloc_array() to replace krealloc()

Use krealloc_array() to replace krealloc() with multiplication.
krealloc_array() has multiply overflow check, which will be safer.

Signed-off-by: Zhang Heng <zhangheng@kylinos.cn>
Link: https://patch.msgid.link/20250117014343.451503-1-zhangheng@kylinos.cn
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Zhang Heng and committed by
Mark Brown
a05143a8 4a91fe4c

+2 -2
+2 -2
sound/soc/sof/topology.c
··· 1273 1273 struct snd_sof_tuple *new_tuples; 1274 1274 1275 1275 num_tuples += token_list[object_token_list[i]].count * (num_sets - 1); 1276 - new_tuples = krealloc(swidget->tuples, 1277 - sizeof(*new_tuples) * num_tuples, GFP_KERNEL); 1276 + new_tuples = krealloc_array(swidget->tuples, 1277 + num_tuples, sizeof(*new_tuples), GFP_KERNEL); 1278 1278 if (!new_tuples) { 1279 1279 ret = -ENOMEM; 1280 1280 goto err;