* [PATCH] i40e: fix uninitialized variable in i40e_set_vsi_promisc
@ 2020-08-12 14:39 Stefan Assmann
2020-08-12 17:46 ` Jakub Kicinski
0 siblings, 1 reply; 3+ messages in thread
From: Stefan Assmann @ 2020-08-12 14:39 UTC (permalink / raw)
To: intel-wired-lan; +Cc: netdev, davem, jeffrey.t.kirsher, lihong.yang, sassmann
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.
Fixes: 37d318d7805f ("i40e: Remove scheduling while atomic possibility")
Signed-off-by: Stefan Assmann <sassmann@kpanic.de>
---
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
index 8e133d6545bd..ae290ebd83cf 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
@@ -1173,7 +1173,7 @@ i40e_set_vsi_promisc(struct i40e_vf *vf, u16 seid, bool multi_enable,
{
struct i40e_pf *pf = vf->pf;
struct i40e_hw *hw = &pf->hw;
- i40e_status aq_ret;
+ i40e_status aq_ret = 0;
int i;
/* No VLAN to set promisc on, set on VSI */
--
2.26.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] i40e: fix uninitialized variable in i40e_set_vsi_promisc
2020-08-12 14:39 [PATCH] i40e: fix uninitialized variable in i40e_set_vsi_promisc Stefan Assmann
@ 2020-08-12 17:46 ` Jakub Kicinski
2020-08-13 5:28 ` Stefan Assmann
0 siblings, 1 reply; 3+ messages in thread
From: Jakub Kicinski @ 2020-08-12 17:46 UTC (permalink / raw)
To: Stefan Assmann
Cc: intel-wired-lan, netdev, davem, jeffrey.t.kirsher, lihong.yang
On Wed, 12 Aug 2020 16:39:50 +0200 Stefan Assmann wrote:
> 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;
What's your compiler? I don't see it on GCC 10.1.
> 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.
I think it'd be a better fix to make num_vlans unsigned.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] i40e: fix uninitialized variable in i40e_set_vsi_promisc
2020-08-12 17:46 ` Jakub Kicinski
@ 2020-08-13 5:28 ` Stefan Assmann
0 siblings, 0 replies; 3+ messages in thread
From: Stefan Assmann @ 2020-08-13 5:28 UTC (permalink / raw)
To: Jakub Kicinski
Cc: intel-wired-lan, netdev, davem, jeffrey.t.kirsher, lihong.yang
On 12.08.20 19:46, Jakub Kicinski wrote:
> On Wed, 12 Aug 2020 16:39:50 +0200 Stefan Assmann wrote:
>> 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;
>
> What's your compiler? I don't see it on GCC 10.1.
gcc version 8.3.1 20191121 (Red Hat 8.3.1-5) (GCC)
>> 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.
>
> I think it'd be a better fix to make num_vlans unsigned.
Agreed, I'll send a v2 patch later.
Thanks for the review Jakub!
Stefan
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-08-13 5:28 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-12 14:39 [PATCH] i40e: fix uninitialized variable in i40e_set_vsi_promisc Stefan Assmann
2020-08-12 17:46 ` Jakub Kicinski
2020-08-13 5:28 ` Stefan Assmann
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).