From: Amitoj Kaur Chawla Date: Thu, 25 Feb 2016 13:55:04 +0000 (+0530) Subject: staging: android: ion: tegra: Use devm_kcalloc instead of devm_kzalloc X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=0969e3d46b7cae0d52ba14e8901105d3cb421eb1;p=linux-beck.git staging: android: ion: tegra: Use devm_kcalloc instead of devm_kzalloc Replace devm_kzalloc with devm_kcalloc to ensure there are no integer overflows from the multiplication of a number * sizeof. The following Coccinelle semantic patch was used to make this change: // @@ expression dev,E1,E3; type T; @@ - devm_kzalloc(dev,E1*sizeof(T),E3) + devm_kcalloc(dev,E1,sizeof(T),E3) // Signed-off-by: Amitoj Kaur Chawla Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/android/ion/tegra/tegra_ion.c b/drivers/staging/android/ion/tegra/tegra_ion.c index 4d3c516cc15e..88285243d53d 100644 --- a/drivers/staging/android/ion/tegra/tegra_ion.c +++ b/drivers/staging/android/ion/tegra/tegra_ion.c @@ -33,9 +33,8 @@ static int tegra_ion_probe(struct platform_device *pdev) num_heaps = pdata->nr; - heaps = devm_kzalloc(&pdev->dev, - sizeof(struct ion_heap *) * pdata->nr, - GFP_KERNEL); + heaps = devm_kcalloc(&pdev->dev, pdata->nr, + sizeof(struct ion_heap *), GFP_KERNEL); idev = ion_device_create(NULL); if (IS_ERR_OR_NULL(idev))