diff options
author | Kamenee Arumugam <kamenee.arumugam@intel.com> | 2018-02-01 12:37:30 -0800 |
---|---|---|
committer | Jason Gunthorpe <jgg@mellanox.com> | 2018-02-01 15:43:32 -0700 |
commit | 953a9cebeab43f33baed79d1a9ef643bfb249c4b (patch) | |
tree | 139004705604d5121675065b3ec0ebd26ce5b9a3 /drivers/infiniband/hw/hfi1/sdma.c | |
parent | 2ff124d597c2df8696169ce0006fc974c49a4569 (diff) | |
download | linux-stable-953a9cebeab43f33baed79d1a9ef643bfb249c4b.tar.gz linux-stable-953a9cebeab43f33baed79d1a9ef643bfb249c4b.tar.bz2 linux-stable-953a9cebeab43f33baed79d1a9ef643bfb249c4b.zip |
IB/hfi1: Convert kzalloc_node and kcalloc to use kcalloc_node
Kzalloc_node API doesn't check for overflows in size multiplication.
While kcalloc API check for overflows in size multiplication
but these implementations are not NUMA-aware.
This conversion allowed for correcting an allocation used in the hot
path to be on the local NUMA and ensure us overflow free multiplication
for the size of a memory allocation.
Reviewed-by: Mike Marciniszyn <mike.marciniszyn@intel.com>
Signed-off-by: Kamenee Arumugam <kamenee.arumugam@intel.com>
Signed-off-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
Diffstat (limited to 'drivers/infiniband/hw/hfi1/sdma.c')
-rw-r--r-- | drivers/infiniband/hw/hfi1/sdma.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/infiniband/hw/hfi1/sdma.c b/drivers/infiniband/hw/hfi1/sdma.c index 37424a81a7c9..d8ddbfdf3a4d 100644 --- a/drivers/infiniband/hw/hfi1/sdma.c +++ b/drivers/infiniband/hw/hfi1/sdma.c @@ -1389,7 +1389,8 @@ int sdma_init(struct hfi1_devdata *dd, u8 port) num_engines, descq_cnt); /* alloc memory for array of send engines */ - dd->per_sdma = kcalloc(num_engines, sizeof(*dd->per_sdma), GFP_KERNEL); + dd->per_sdma = kcalloc_node(num_engines, sizeof(*dd->per_sdma), + GFP_KERNEL, dd->node); if (!dd->per_sdma) return ret; |