Skip to contentSkip to conversation

drivers/infiniband/hw/qib/qib_init.c: use kmalloc_array_node()

PATCH New [email protected] 1 participant 1 message Nov 16, 2017 InfiniBand

lore
Share & tools
lore
#0 lore raw

PATCH 23/131 drivers/infiniband/hw/qib/qib_init.c: use kmalloc_array_node()

From: Johannes Thumshirn <[email protected]>
Subject: drivers/infiniband/hw/qib/qib_init.c: use kmalloc_array_node()

Now that we have a NUMA-aware version of kmalloc_array() we can use it instead of kmalloc_node() without an overflow check in the size calculation.

Cc Mike Marciniszyn <[email protected]>
Cc Doug Ledford <[email protected]>
Cc Sean Hefty <[email protected]>
Cc Hal Rosenstock <[email protected]>
Cc Christoph Hellwig <[email protected]>
Cc Damien Le Moal <[email protected]>
Cc David Rientjes <[email protected]>
Cc "David S. Miller" <[email protected]>
Cc Jens Axboe <[email protected]>
Cc Joonsoo Kim <[email protected]>
Cc Pekka Enberg <[email protected]>
Cc Santosh Shilimkar <[email protected]>
Cc Vlastimil Babka <[email protected]>

---

 drivers/infiniband/hw/qib/qib_init.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/infiniband/hw/qib/qib_init.c renamed from drivers/infiniband/hw/qib/qib_init.c~ib-qib-use-kmalloc_array_node +3 -2
diff -puN drivers/infiniband/hw/qib/qib_init.c~ib-qib-use-kmalloc_array_node drivers/infiniband/hw/qib/qib_init.c
@@ -1674,8 +1674,9 @@ int qib_setup_eagerbufs(struct qib_ctxtd
 	}
 	if (!rcd->rcvegrbuf_phys) {
 		rcd->rcvegrbuf_phys =
-			kmalloc_node(chunk * sizeof(rcd->rcvegrbuf_phys[0]),
-				GFP_KERNEL, rcd->node_id);
+			kmalloc_array_node(chunk,
+					   sizeof(rcd->rcvegrbuf_phys[0]),
+					   GFP_KERNEL, rcd->node_id);
 		if (!rcd->rcvegrbuf_phys)
 			goto bail_rcvegrbuf;
 	}

_