Skip to content
Commit d037d896 authored by Stefan Assmann's avatar Stefan Assmann Committed by Greg Kroah-Hartman
Browse files

i40e: fix return of uninitialized aq_ret in i40e_set_vsi_promisc

[ Upstream commit e1e1b535 ]

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: 37d318d7

 ("i40e: Remove scheduling while atomic possibility")
Signed-off-by: default avatarStefan Assmann <sassmann@kpanic.de>
Acked-by: default avatarJakub Kicinski <kuba@kernel.org>
Tested-by: default avatarAaron Brown <aaron.f.brown@intel.com>
Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 2d78e2d3
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