Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Srishti Sharma and committed by
Mauro Carvalho Chehab
abe51392 e6cc7108

+3 -1
+3 -1
drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_firmware.c
··· 235 235 sh_css_blob_info = NULL; 236 236 } 237 237 238 - fw_minibuffer = kzalloc(sh_css_num_binaries * sizeof(struct fw_param), GFP_KERNEL); 238 + fw_minibuffer = kcalloc(sh_css_num_binaries, sizeof(struct fw_param), 239 + GFP_KERNEL); 240 + 239 241 if (fw_minibuffer == NULL) 240 242 return IA_CSS_ERR_CANNOT_ALLOCATE_MEMORY; 241 243