public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: SF Markus Elfring <elfring@users.sourceforge.net>
To: linux-rdma@vger.kernel.org, Doug Ledford <dledford@redhat.com>,
	Faisal Latif <faisal.latif@intel.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/5] IB/nes: Use kcalloc() in nes_init_mgt_qp()
Date: Mon, 6 Mar 2017 18:40:13 +0100	[thread overview]
Message-ID: <c7ce5066-0466-209e-883b-677768c771a4@users.sourceforge.net> (raw)
In-Reply-To: <502a5a6f-ee91-dd2f-cdc7-63f396059529@users.sourceforge.net>

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Mon, 6 Mar 2017 16:07:41 +0100

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

  This issue was detected by using the Coccinelle software.

* Replace the specification of a data type by a pointer dereference
  to make the corresponding size determination a bit safer according to
  the Linux coding style convention.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/infiniband/hw/nes/nes_mgt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/infiniband/hw/nes/nes_mgt.c b/drivers/infiniband/hw/nes/nes_mgt.c
index 33624f17c347..a84fffd33c21 100644
--- a/drivers/infiniband/hw/nes/nes_mgt.c
+++ b/drivers/infiniband/hw/nes/nes_mgt.c
@@ -877,7 +877,7 @@ int nes_init_mgt_qp(struct nes_device *nesdev, struct net_device *netdev, struct
 	int ret;
 
 	/* Allocate space the all mgt QPs once */
-	mgtvnic = kzalloc(NES_MGT_QP_COUNT * sizeof(struct nes_vnic_mgt), GFP_KERNEL);
+	mgtvnic = kcalloc(NES_MGT_QP_COUNT, sizeof(*mgtvnic), GFP_KERNEL);
 	if (!mgtvnic)
 		return -ENOMEM;
 
-- 
2.12.0

  reply	other threads:[~2017-03-06 17:40 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-06 17:38 [PATCH 0/5] IB/nes: Fine-tuning for some function implementations SF Markus Elfring
2017-03-06 17:40 ` SF Markus Elfring [this message]
2017-03-06 17:41 ` [PATCH 2/5] IB/nes: Use kcalloc() in nes_reg_user_mr() SF Markus Elfring
2017-03-06 17:42 ` [PATCH 3/5] IB/nes: Adjust 16 checks for null pointers SF Markus Elfring
2017-03-06 17:43 ` [PATCH 4/5] IB/nes: Delete unnecessary braces SF Markus Elfring
2017-03-06 18:37   ` Joe Perches
2017-03-07  0:34     ` [PATCH] IB/nes: Neaten nes_alloc_mw Joe Perches
2017-03-06 20:56   ` [PATCH 4/5] IB/nes: Delete unnecessary braces Julia Lawall
2017-03-06 17:44 ` [PATCH 5/5] IB/nes: Improve size determinations in two functions 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=c7ce5066-0466-209e-883b-677768c771a4@users.sourceforge.net \
    --to=elfring@users.sourceforge.net \
    --cc=dledford@redhat.com \
    --cc=faisal.latif@intel.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