From: SF Markus Elfring <elfring@users.sourceforge.net>
To: linux-rdma@vger.kernel.org, Christian Benvenuti <benve@cisco.com>,
Dave Goodell <dgoodell@cisco.com>,
Doug Ledford <dledford@redhat.com>,
Hal Rosenstock <hal.rosenstock@gmail.com>,
Sean Hefty <sean.hefty@intel.com>
Cc: LKML <linux-kernel@vger.kernel.org>, kernel-janitors@vger.kernel.org
Subject: [PATCH 1/2] IB/usnic: Use kcalloc() in alloc_res_chunk_list()
Date: Thu, 6 Apr 2017 22:09:45 +0200 [thread overview]
Message-ID: <db43dde0-c172-a9e5-1878-1bada275d095@users.sourceforge.net> (raw)
In-Reply-To: <f0a030a8-2a03-f531-57d8-39c2aeae28a4@users.sourceforge.net>
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Thu, 6 Apr 2017 20:32:39 +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/infiniband/hw/usnic/usnic_ib_qp_grp.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/infiniband/hw/usnic/usnic_ib_qp_grp.c b/drivers/infiniband/hw/usnic/usnic_ib_qp_grp.c
index 092d4e11a633..817f0475d9fe 100644
--- a/drivers/infiniband/hw/usnic/usnic_ib_qp_grp.c
+++ b/drivers/infiniband/hw/usnic/usnic_ib_qp_grp.c
@@ -545,8 +545,8 @@ alloc_res_chunk_list(struct usnic_vnic *vnic,
/* Do Nothing */
}
- res_chunk_list = kzalloc(sizeof(*res_chunk_list)*(res_lst_sz+1),
- GFP_ATOMIC);
+ res_chunk_list = kcalloc(res_lst_sz + 1, sizeof(*res_chunk_list),
+ GFP_ATOMIC);
if (!res_chunk_list)
return ERR_PTR(-ENOMEM);
--
2.12.2
next prev parent reply other threads:[~2017-04-06 20:10 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-06 20:08 [PATCH 0/2] IB/usnic: Fine-tuning for two function implementations SF Markus Elfring
2017-04-06 20:09 ` SF Markus Elfring [this message]
2017-04-06 20:10 ` [PATCH 2/2] IB/usnic: Use kcalloc() in usnic_vnic_alloc_res_chunk() SF Markus Elfring
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=db43dde0-c172-a9e5-1878-1bada275d095@users.sourceforge.net \
--to=elfring@users.sourceforge.net \
--cc=benve@cisco.com \
--cc=dgoodell@cisco.com \
--cc=dledford@redhat.com \
--cc=hal.rosenstock@gmail.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=sean.hefty@intel.com \
/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
Powered by JetHome