[Intel-wired-lan] [PATCH net-next 1/7] ice: Fix static analyzer hit

Tony Nguyen anthony.l.nguyen at intel.com
Fri Jul 16 22:16:38 UTC 2021


From: Anirudh Venkataramanan <anirudh.venkataramanan at intel.com>

Static analysis reports that the pointer returned by ice_get_main_vsi is
not checked. Fix it.

Signed-off-by: Anirudh Venkataramanan <anirudh.venkataramanan at intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen at intel.com>
---
 drivers/net/ethernet/intel/ice/ice_devlink.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/net/ethernet/intel/ice/ice_devlink.c b/drivers/net/ethernet/intel/ice/ice_devlink.c
index 792a3972dec3..4f709d71cc33 100644
--- a/drivers/net/ethernet/intel/ice/ice_devlink.c
+++ b/drivers/net/ethernet/intel/ice/ice_devlink.c
@@ -621,7 +621,10 @@ int ice_devlink_create_pf_port(struct ice_pf *pf)
 	dev = ice_pf_to_dev(pf);
 
 	devlink_port = &pf->devlink_port;
+
 	vsi = ice_get_main_vsi(pf);
+	if (!vsi)
+		return -EIO;
 
 	attrs.flavour = DEVLINK_PORT_FLAVOUR_PHYSICAL;
 	attrs.phys.port_number = pf->hw.bus.func;
-- 
2.20.1



More information about the Intel-wired-lan mailing list