Skip to contentSkip to conversation

qedr: Add GSI support

bug report Dan Carpenter 2 participants 2 messages Oct 26, 2016 – Oct 27, 2016 1 message not in the archive InfiniBand

lore
Share & tools
lore
#0 lore raw

Hello Ram Amrani,

This is a semi-automatic email about new static checker warnings.

The patch 048867793046: "qedr: Add GSI support" from Oct 10, 2016, leads to the following Smatch complaint:

drivers/infiniband/hw/qedr/qedr_cm.c:284 qedr_gsi_build_header()
warn: variable dereferenced before check 'sgid_attr.ndev' (see line 281)

drivers/infiniband/hw/qedr/qedr_cm.c
280

   281		vlan_id = rdma_vlan_dev_vlan_id(sgid_attr.ndev);
                                                ^^^^^^^^^^^^^^

Dereference inside function.

282 if (vlan_id < VLAN_CFI_MASK)
283 has_vlan = true;
284 if (sgid_attr.ndev)

                    ^^^^^^^^^^^^^^

Check too late.

   285			dev_put(sgid_attr.ndev);
   286	

regards,
dan carpenter
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): [email protected]

#2 lore raw
Quoted 11 lines

The patch 048867793046: "qedr: Add GSI support" from Oct 10, 2016, leads to the following Smatch complaint:

drivers/infiniband/hw/qedr/qedr_cm.c:284 qedr_gsi_build_header()
warn: variable dereferenced before check 'sgid_attr.ndev' (see line 281)

drivers/infiniband/hw/qedr/qedr_cm.c
280

   281		vlan_id = rdma_vlan_dev_vlan_id(sgid_attr.ndev);
                                                ^^^^^^^^^^^^^^ Dereference inside function.
Quoted 8 lines
   282		if (vlan_id < VLAN_CFI_MASK)
   283			has_vlan = true;
   284		if (sgid_attr.ndev)
                    ^^^^^^^^^^^^^^

Check too late.

   285			dev_put(sgid_attr.ndev);
   286

Thanks Dan. I'll fix this.
Ram
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html