Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1619096 > unrolled thread
| Started by | SF Markus Elfring <elfring@users.sourceforge.net> |
|---|---|
| First post | 2017-04-07 23:00 +0200 |
| Last post | 2017-04-09 14:30 +0200 |
| Articles | 2 — 2 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
[PATCH 1/9] IB/IPoIB: Use kcalloc() in two functions SF Markus Elfring <elfring@users.sourceforge.net> - 2017-04-07 23:00 +0200
Re: [PATCH 1/9] IB/IPoIB: Use kcalloc() in two functions Sagi Grimberg <sagi@grimberg.me> - 2017-04-09 14:30 +0200
| From | SF Markus Elfring <elfring@users.sourceforge.net> |
|---|---|
| Date | 2017-04-07 23:00 +0200 |
| Subject | [PATCH 1/9] IB/IPoIB: Use kcalloc() in two functions |
| Message-ID | <ttJ97-4g5-1@gated-at.bofh.it> |
From: Markus Elfring <elfring@users.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@users.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
[toc] | [next] | [standalone]
| From | Sagi Grimberg <sagi@grimberg.me> |
|---|---|
| Date | 2017-04-09 14:30 +0200 |
| Message-ID | <tuk8F-2Iy-3@gated-at.bofh.it> |
| In reply to | #1619096 |
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web