aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/android
diff options
context:
space:
mode:
authorAmitoj Kaur Chawla <amitoj1606@gmail.com>2016-02-25 20:21:20 +0530
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2016-03-11 22:09:09 -0800
commit0103fe20a7dd343c43bec6215e01cd6bedddd5eb (patch)
tree7c83aacc15be6008d89ad01e0006cca704af78ed /drivers/staging/android
parentstaging: android: Replace min_t/max_t with min/max (diff)
downloadlinux-dev-0103fe20a7dd343c43bec6215e01cd6bedddd5eb.tar.xz
linux-dev-0103fe20a7dd343c43bec6215e01cd6bedddd5eb.zip
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>
Diffstat (limited to 'drivers/staging/android')
-rw-r--r--drivers/staging/android/timed_gpio.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/staging/android/timed_gpio.c b/drivers/staging/android/timed_gpio.c
index bcd9924d4631..914fd1005467 100644
--- a/drivers/staging/android/timed_gpio.c
+++ b/drivers/staging/android/timed_gpio.c
@@ -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;