HSI: Use kcalloc() in hsi_register_board_info()
authorMarkus Elfring <elfring@users.sourceforge.net>
Tue, 25 Apr 2017 11:56:08 +0000 (13:56 +0200)
committerSebastian Reichel <sre@kernel.org>
Thu, 8 Jun 2017 11:21:43 +0000 (13:21 +0200)
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>
drivers/hsi/hsi_boardinfo.c

index e56bc6da5f98653ac4b2863f1e0297eefb2046d7..e381cb4c962e20e1943349c2d9492d3f37225ce5 100644 (file)
@@ -49,7 +49,7 @@ int __init hsi_register_board_info(struct hsi_board_info const *info,
 {
        struct hsi_cl_info *cl_info;
 
-       cl_info = kzalloc(sizeof(*cl_info) * len, GFP_KERNEL);
+       cl_info = kcalloc(len, sizeof(*cl_info), GFP_KERNEL);
        if (!cl_info)
                return -ENOMEM;