summaryrefslogtreecommitdiff
path: root/drivers/staging/rdma
diff options
context:
space:
mode:
authorEaswar Hariharan <easwar.hariharan@intel.com>2015-12-10 11:13:38 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2015-12-21 14:00:17 -0800
commit859bcad9c2c5487dd74d4cfbdcbdd6c63a0ca955 (patch)
tree197b962b1dcdab64c9e7afcb00348010e51e967b /drivers/staging/rdma
parent5cd24119d437910d15c510218dcd32f57355a3d3 (diff)
staging/rdma/hfi1: Fix a possible null pointer dereference
A code inspection pointed out that kmalloc_array may return NULL and memset doesn't check the input pointer for NULL, resulting in a possible NULL dereference. This patch fixes this. Reviewed-by: Mike Marciniszyn <mike.marciniszyn@intel.com> Signed-off-by: Easwar Hariharan <easwar.hariharan@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/rdma')
-rw-r--r--drivers/staging/rdma/hfi1/chip.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/staging/rdma/hfi1/chip.c b/drivers/staging/rdma/hfi1/chip.c
index d88945a80250..371f13fec68d 100644
--- a/drivers/staging/rdma/hfi1/chip.c
+++ b/drivers/staging/rdma/hfi1/chip.c
@@ -13358,6 +13358,8 @@ static void init_qos(struct hfi1_devdata *dd, u32 first_ctxt)
if (num_vls * qpns_per_vl > dd->chip_rcv_contexts)
goto bail;
rsmmap = kmalloc_array(NUM_MAP_REGS, sizeof(u64), GFP_KERNEL);
+ if (!rsmmap)
+ goto bail;
memset(rsmmap, rxcontext, NUM_MAP_REGS * sizeof(u64));
/* init the local copy of the table */
for (i = 0, ctxt = first_ctxt; i < num_vls; i++) {