Skip to content

Commit 96bcb34

Browse files
qianfengrongbroonie
authored andcommitted
ASoC: test-component: Use kcalloc() instead of kzalloc()
Use devm_kcalloc() in test_driver_probe() to gain built-in overflow protection, making memory allocation safer when calculating allocation size compared to explicit multiplication. Signed-off-by: Qianfeng Rong <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent 3b6f4bd commit 96bcb34

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

sound/soc/generic/test-component.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -547,8 +547,8 @@ static int test_driver_probe(struct platform_device *pdev)
547547

548548
priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
549549
cdriv = devm_kzalloc(dev, sizeof(*cdriv), GFP_KERNEL);
550-
ddriv = devm_kzalloc(dev, sizeof(*ddriv) * num, GFP_KERNEL);
551-
dname = devm_kzalloc(dev, sizeof(*dname) * num, GFP_KERNEL);
550+
ddriv = devm_kcalloc(dev, num, sizeof(*ddriv), GFP_KERNEL);
551+
dname = devm_kcalloc(dev, num, sizeof(*dname), GFP_KERNEL);
552552
if (!priv || !cdriv || !ddriv || !dname || !adata)
553553
return -EINVAL;
554554

0 commit comments

Comments
 (0)