Skip to content

Commit abe5139

Browse files
srishti9612mchehab
authored andcommitted
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 <[email protected]> Signed-off-by: Sakari Ailus <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
1 parent e6cc710 commit abe5139

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_firmware.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,9 @@ sh_css_load_firmware(const char *fw_data,
235235
sh_css_blob_info = NULL;
236236
}
237237

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+
239241
if (fw_minibuffer == NULL)
240242
return IA_CSS_ERR_CANNOT_ALLOCATE_MEMORY;
241243

0 commit comments

Comments
 (0)