mirror of
https://github.com/FEX-Emu/linux.git
synced 2024-12-29 04:45:05 +00:00
staging: android: 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: //<smpl> @@ expression dev,E1,E2,E3; @@ - devm_kzalloc(dev,E1*sizeof(E2),E3) + devm_kcalloc(dev,E1,sizeof(E2),E3) //</smpl> Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
9f1c427d80
commit
0103fe20a7
@ -92,9 +92,8 @@ static int timed_gpio_probe(struct platform_device *pdev)
|
||||
if (!pdata)
|
||||
return -EBUSY;
|
||||
|
||||
gpio_data = devm_kzalloc(&pdev->dev,
|
||||
sizeof(*gpio_data) * pdata->num_gpios,
|
||||
GFP_KERNEL);
|
||||
gpio_data = devm_kcalloc(&pdev->dev, pdata->num_gpios,
|
||||
sizeof(*gpio_data), GFP_KERNEL);
|
||||
if (!gpio_data)
|
||||
return -ENOMEM;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user