Commit d38d7fda authored by Gustavo A. R. Silva's avatar Gustavo A. R. Silva Committed by Doug Ledford

RDMA/qedr: add null check before pointer dereference

Add null check before dereferencing pointer sgid_attr.ndev
inside function rdma_vlan_dev_vlan_id().

Addresses-Coverity-ID: 1373979
Signed-off-by: default avatarGustavo A. R. Silva <garsilva@embeddedor.com>
Acked-by: default avatarRam Amrani <Ram.Amrani@cavium.com>
Signed-off-by: default avatarDoug Ledford <dledford@redhat.com>
parent 6e8484c5
...@@ -270,11 +270,13 @@ static inline int qedr_gsi_build_header(struct qedr_dev *dev, ...@@ -270,11 +270,13 @@ static inline int qedr_gsi_build_header(struct qedr_dev *dev,
return rc; return rc;
} }
vlan_id = rdma_vlan_dev_vlan_id(sgid_attr.ndev); if (sgid_attr.ndev) {
if (vlan_id < VLAN_CFI_MASK) vlan_id = rdma_vlan_dev_vlan_id(sgid_attr.ndev);
has_vlan = true; if (vlan_id < VLAN_CFI_MASK)
if (sgid_attr.ndev) has_vlan = true;
dev_put(sgid_attr.ndev); dev_put(sgid_attr.ndev);
}
if (!memcmp(&sgid, &zgid, sizeof(sgid))) { if (!memcmp(&sgid, &zgid, sizeof(sgid))) {
DP_ERR(dev, "gsi post send: GID not found GID index %d\n", DP_ERR(dev, "gsi post send: GID not found GID index %d\n",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment