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

HSI: Use kcalloc() in hsi_register_board_info()

A multiplication for the size determination of a memory allocation
indicated that an array data structure should be processed.
Thus use the corresponding function "kcalloc".

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>

authored by

Markus Elfring and committed by
Sebastian Reichel
de7c98eb 0fbad7c8

+1 -1
+1 -1
drivers/hsi/hsi_boardinfo.c
··· 49 49 { 50 50 struct hsi_cl_info *cl_info; 51 51 52 - cl_info = kzalloc(sizeof(*cl_info) * len, GFP_KERNEL); 52 + cl_info = kcalloc(len, sizeof(*cl_info), GFP_KERNEL); 53 53 if (!cl_info) 54 54 return -ENOMEM; 55 55