[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <b6829c25-7c8b-858d-5cad-0322d6536f44@users.sourceforge.net>
Date: Fri, 7 Apr 2017 22:57:07 +0200
From: SF Markus Elfring <elfring@...rs.sourceforge.net>
To: linux-rdma@...r.kernel.org, target-devel@...r.kernel.org,
David Ahern <dsa@...ulusnetworks.com>,
Doug Ledford <dledford@...hat.com>,
Erez Shitrit <erezsh@...lanox.com>,
Feras Daoud <ferasda@...lanox.com>,
Hal Rosenstock <hal.rosenstock@...il.com>,
Leon Romanovsky <leon@...nel.org>,
Mark Bloch <markb@...lanox.com>,
Or Gerlitz <ogerlitz@...lanox.com>,
Paolo Abeni <pabeni@...hat.com>, Roi Dayan <roid@...lanox.com>,
Sagi Grimberg <sagi@...mberg.me>,
Sean Hefty <sean.hefty@...el.com>,
Yuval Shaia <yuval.shaia@...cle.com>,
Zhu Yanjun <yanjun.zhu@...cle.com>
Cc: LKML <linux-kernel@...r.kernel.org>,
kernel-janitors@...r.kernel.org
Subject: [PATCH 1/9] IB/IPoIB: Use kcalloc() in two functions
From: Markus Elfring <elfring@...rs.sourceforge.net>
Date: Fri, 7 Apr 2017 17:43:51 +0200
Multiplications for the size determination of memory allocations
indicated that array data structures should be processed.
Thus use the corresponding function "kcalloc".
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring <elfring@...rs.sourceforge.net>
---
drivers/infiniband/ulp/ipoib/ipoib_main.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c
index d1d3fb7a6127..3d3e49fb15b7 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_main.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c
@@ -1484,7 +1484,7 @@ static int ipoib_neigh_hash_init(struct ipoib_dev_priv *priv)
return -ENOMEM;
set_bit(IPOIB_STOP_NEIGH_GC, &priv->flags);
size = roundup_pow_of_two(arp_tbl.gc_thresh3);
- buckets = kzalloc(size * sizeof(*buckets), GFP_KERNEL);
+ buckets = kcalloc(size, sizeof(*buckets), GFP_KERNEL);
if (!buckets) {
kfree(htbl);
return -ENOMEM;
@@ -1628,7 +1628,7 @@ int ipoib_dev_init(struct net_device *dev, struct ib_device *ca, int port)
struct ipoib_dev_priv *priv = netdev_priv(dev);
/* Allocate RX/TX "rings" to hold queued skbs */
- priv->rx_ring = kzalloc(ipoib_recvq_size * sizeof *priv->rx_ring,
+ priv->rx_ring = kcalloc(ipoib_recvq_size, sizeof(*priv->rx_ring),
GFP_KERNEL);
if (!priv->rx_ring)
goto out;
--
2.12.2
Powered by blists - more mailing lists