From: SF Markus Elfring <elfring@users.sourceforge.net>
To: "Andrew F. Davis" <afd@ti.com>,
Carlos Chinea <carlos.chinea@nokia.com>,
Linus Walleij <linus.walleij@linaro.org>,
Sebastian Reichel <sre@kernel.org>
Cc: LKML <linux-kernel@vger.kernel.org>, kernel-janitors@vger.kernel.org
Subject: [PATCH 1/2] HSI: Use kcalloc() in hsi_register_board_info()
Date: Tue, 25 Apr 2017 12:45:04 +0000 [thread overview]
Message-ID: <7c7f7b19-d3f3-6653-6830-5b00660fa2b1@users.sourceforge.net> (raw)
In-Reply-To: <52f7db50-a3a0-6bc5-a39f-1d235a5945cd@users.sourceforge.net>
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Tue, 25 Apr 2017 13:56:08 +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>
---
drivers/hsi/hsi_boardinfo.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/hsi/hsi_boardinfo.c b/drivers/hsi/hsi_boardinfo.c
index e56bc6da5f98..e381cb4c962e 100644
--- a/drivers/hsi/hsi_boardinfo.c
+++ b/drivers/hsi/hsi_boardinfo.c
@@ -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;
--
2.12.2
next prev parent reply other threads:[~2017-04-25 12:45 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-25 12:43 [PATCH 0/2] HSI: Fine-tuning for three function implementations SF Markus Elfring
2017-04-25 12:45 ` SF Markus Elfring [this message]
2017-04-25 12:46 ` [PATCH 2/2] HSI: core: Use kcalloc() in two functions SF Markus Elfring
2017-05-01 9:08 ` [PATCH 0/2] HSI: Fine-tuning for three function implementations Sebastian Reichel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7c7f7b19-d3f3-6653-6830-5b00660fa2b1@users.sourceforge.net \
--to=elfring@users.sourceforge.net \
--cc=afd@ti.com \
--cc=carlos.chinea@nokia.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linus.walleij@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=sre@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox