summaryrefslogtreecommitdiffstats
path: root/drivers/infiniband
diff options
context:
space:
mode:
authorTadeusz Struk <tadeusz.struk@intel.com>2016-06-09 10:51:45 -0400
committerDoug Ledford <dledford@redhat.com>2016-06-17 20:11:27 -0400
commit93dd0a097859a174817ea94ec55bfc29c5706454 (patch)
tree11187370374edd6dabd62e9c06ebcf040cbcd89c /drivers/infiniband
parent5e9ef24619486213223053678eb9175630ef6bf9 (diff)
IB/hfi1: Fix potential NULL ptr dereference
This fixes potential NULL ptr dereference because IS_ERR(dd) doesn't handle NULL. Fix the issue by initializing the pointer with a not NULL error code. Reviewed-by: Dennis Dalessandro <dennis.dalessandro@intel.com> Signed-off-by: Tadeusz Struk <tadeusz.struk@intel.com> Signed-off-by: Doug Ledford <dledford@redhat.com>
Diffstat (limited to 'drivers/infiniband')
-rw-r--r--drivers/infiniband/hw/hfi1/init.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/infiniband/hw/hfi1/init.c b/drivers/infiniband/hw/hfi1/init.c
index 0d28a5a40fae..eed971ccd2a1 100644
--- a/drivers/infiniband/hw/hfi1/init.c
+++ b/drivers/infiniband/hw/hfi1/init.c
@@ -1383,7 +1383,7 @@ static void postinit_cleanup(struct hfi1_devdata *dd)
1383static int init_one(struct pci_dev *pdev, const struct pci_device_id *ent) 1383static int init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
1384{ 1384{
1385 int ret = 0, j, pidx, initfail; 1385 int ret = 0, j, pidx, initfail;
1386 struct hfi1_devdata *dd = NULL; 1386 struct hfi1_devdata *dd = ERR_PTR(-EINVAL);
1387 struct hfi1_pportdata *ppd; 1387 struct hfi1_pportdata *ppd;
1388 1388
1389 /* First, lock the non-writable module parameters */ 1389 /* First, lock the non-writable module parameters */