summaryrefslogtreecommitdiff
path: root/drivers/staging/fbtft
diff options
context:
space:
mode:
authorAmitoj Kaur Chawla <amitoj1606@gmail.com>2016-02-25 18:50:58 +0530
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2016-03-11 22:09:09 -0800
commit0c9ab986e2dc87bd7c87384afeddd1326570d03e (patch)
treecde2f43cffb6ed851d5661ee0be3692cac95631f /drivers/staging/fbtft
parent71e03f10384c16887d5dd32c6b1e7006b09ec592 (diff)
staging: fbtft: 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,E4; @@ - devm_kzalloc(dev,E1*E2*sizeof(E3),E4) + devm_kcalloc(dev,E1*E2,sizeof(E3),E4) //</smpl> Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/fbtft')
-rw-r--r--drivers/staging/fbtft/fbtft-core.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/staging/fbtft/fbtft-core.c b/drivers/staging/fbtft/fbtft-core.c
index 574c14828ca3..0c1a77cafe14 100644
--- a/drivers/staging/fbtft/fbtft-core.c
+++ b/drivers/staging/fbtft/fbtft-core.c
@@ -736,8 +736,11 @@ struct fb_info *fbtft_framebuffer_alloc(struct fbtft_display *display,
goto alloc_fail;
if (display->gamma_num && display->gamma_len) {
- gamma_curves = devm_kzalloc(dev, display->gamma_num * display->gamma_len * sizeof(gamma_curves[0]),
- GFP_KERNEL);
+ gamma_curves = devm_kcalloc(dev,
+ display->gamma_num *
+ display->gamma_len,
+ sizeof(gamma_curves[0]),
+ GFP_KERNEL);
if (!gamma_curves)
goto alloc_fail;
}