ice: always check VF VSI pointer values
authorJacob Keller <jacob.e.keller@intel.com>
Mon, 11 Apr 2022 23:29:03 +0000 (16:29 -0700)
committerTony Nguyen <anthony.l.nguyen@intel.com>
Thu, 5 May 2022 18:28:36 +0000 (11:28 -0700)
commitbaeb705fd6a7245cc1fa69ed991a9cffdf44a174
treea1e7573c62b525453202e0f3b443cab5e739a023
parent9880d3d6f9e3ab264d58368306dd83218ea6a3c1
ice: always check VF VSI pointer values

The ice_get_vf_vsi function can return NULL in some cases, such as if
handling messages during a reset where the VSI is being removed and
recreated.

Several places throughout the driver do not bother to check whether this
VSI pointer is valid. Static analysis tools maybe report issues because
they detect paths where a potentially NULL pointer could be dereferenced.

Fix this by checking the return value of ice_get_vf_vsi everywhere.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Reviewed-by: Paul Menzel <pmenzel@molgen.mpg.de>
Tested-by: Konrad Jankowski <konrad0.jankowski@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
drivers/net/ethernet/intel/ice/ice_devlink.c
drivers/net/ethernet/intel/ice/ice_repr.c
drivers/net/ethernet/intel/ice/ice_sriov.c
drivers/net/ethernet/intel/ice/ice_vf_lib.c
drivers/net/ethernet/intel/ice/ice_virtchnl.c
drivers/net/ethernet/intel/ice/ice_virtchnl_fdir.c