summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorSrishti Sharma <srishtishar@gmail.com>2017-09-14 06:18:40 -0400
committerMauro Carvalho Chehab <mchehab@s-opensource.com>2017-09-23 15:09:01 -0400
commitabe513924879432a17a1cab1bc408b110fb04fac (patch)
tree8bfdb49d71cd7905c8255a05b16cda6decdce7b6 /drivers
parente6cc710806e191acfa2691d2fb8cb7f19ffd2b0e (diff)
downloadlinux-abe513924879432a17a1cab1bc408b110fb04fac.tar.gz
linux-abe513924879432a17a1cab1bc408b110fb04fac.tar.bz2
linux-abe513924879432a17a1cab1bc408b110fb04fac.zip
media: Staging: media: atomisp: Use kcalloc instead of kzalloc
Use kcalloc instead of kzalloc to check for an overflow before multiplication. Done using the following semantic patch by coccinelle. http://coccinelle.lip6.fr/rules/kzalloc.cocci Signed-off-by: Srishti Sharma <srishtishar@gmail.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_firmware.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_firmware.c b/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_firmware.c
index 696f5020dce6..5e45d5fe0b2a 100644
--- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_firmware.c
+++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_firmware.c
@@ -235,7 +235,9 @@ sh_css_load_firmware(const char *fw_data,
sh_css_blob_info = NULL;
}
- fw_minibuffer = kzalloc(sh_css_num_binaries * sizeof(struct fw_param), GFP_KERNEL);
+ fw_minibuffer = kcalloc(sh_css_num_binaries, sizeof(struct fw_param),
+ GFP_KERNEL);
+
if (fw_minibuffer == NULL)
return IA_CSS_ERR_CANNOT_ALLOCATE_MEMORY;