OSDN Git Service

i40e: fix return of uninitialized aq_ret in i40e_set_vsi_promisc
authorStefan Assmann <sassmann@kpanic.de>
Thu, 13 Aug 2020 11:26:38 +0000 (13:26 +0200)
committerTony Nguyen <anthony.l.nguyen@intel.com>
Wed, 9 Sep 2020 22:06:23 +0000 (15:06 -0700)
commite1e1b5356eb48dce4307f5cae10e4d6d5bd3df74
tree14cc7a819afe862e4bb79261aa1c7d5bb0fe9426
parentb87f9fe1ac9441b75656dfd95eba70ef9f0375e0
i40e: fix return of uninitialized aq_ret in i40e_set_vsi_promisc

drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c: In function ‘i40e_set_vsi_promisc’:
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c:1176:14: error: ‘aq_ret’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
  i40e_status aq_ret;

In case the code inside the if statement and the for loop does not get
executed aq_ret will be uninitialized when the variable gets returned at
the end of the function.

Avoid this by changing num_vlans from int to u16, so aq_ret always gets
set. Making this change in additional places as num_vlans should never
be negative.

Fixes: 37d318d7805f ("i40e: Remove scheduling while atomic possibility")
Signed-off-by: Stefan Assmann <sassmann@kpanic.de>
Acked-by: Jakub Kicinski <kuba@kernel.org>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c