diff mbox series

[net,9/9] net: qed: fix "maybe uninitialized" warning

Message ID 20200622111413.7006-10-alobakin@marvell.com
State Changes Requested
Delegated to: David Miller
Headers show
Series net: qed/qede: various stability fixes | expand

Commit Message

Alexander Lobakin June 22, 2020, 11:14 a.m. UTC
Variable 'abs_ppfid' in qed_dev.c:qed_llh_add_mac_filter() always gets
printed, but is initialized only under 'ref_cnt == 1' condition. This
results in:

In file included from ./include/linux/kernel.h:15:0,
                 from ./include/asm-generic/bug.h:19,
                 from ./arch/x86/include/asm/bug.h:86,
                 from ./include/linux/bug.h:5,
                 from ./include/linux/io.h:11,
                 from drivers/net/ethernet/qlogic/qed/qed_dev.c:35:
drivers/net/ethernet/qlogic/qed/qed_dev.c: In function 'qed_llh_add_mac_filter':
./include/linux/printk.h:358:2: warning: 'abs_ppfid' may be used uninitialized
in this function [-Wmaybe-uninitialized]
  printk(KERN_NOTICE pr_fmt(fmt), ##__VA_ARGS__)
  ^~~~~~
drivers/net/ethernet/qlogic/qed/qed_dev.c:983:17: note: 'abs_ppfid' was declared
here
  u8 filter_idx, abs_ppfid;
                 ^~~~~~~~~

...under W=1+.

Fix this by initializing it with zero.

Fixes: 79284adeb99e ("qed: Add llh ppfid interface and 100g support for
offload protocols")
Signed-off-by: Alexander Lobakin <alobakin@marvell.com>
Signed-off-by: Igor Russkikh <irusskikh@marvell.com>
Signed-off-by: Michal Kalderon <michal.kalderon@marvell.com>
---
 drivers/net/ethernet/qlogic/qed/qed_dev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Jakub Kicinski June 22, 2020, 9:44 p.m. UTC | #1
On Mon, 22 Jun 2020 14:14:13 +0300 Alexander Lobakin wrote:
> Variable 'abs_ppfid' in qed_dev.c:qed_llh_add_mac_filter() always gets
> printed, but is initialized only under 'ref_cnt == 1' condition. This
> results in:
> 
> In file included from ./include/linux/kernel.h:15:0,
>                  from ./include/asm-generic/bug.h:19,
>                  from ./arch/x86/include/asm/bug.h:86,
>                  from ./include/linux/bug.h:5,
>                  from ./include/linux/io.h:11,
>                  from drivers/net/ethernet/qlogic/qed/qed_dev.c:35:
> drivers/net/ethernet/qlogic/qed/qed_dev.c: In function 'qed_llh_add_mac_filter':
> ./include/linux/printk.h:358:2: warning: 'abs_ppfid' may be used uninitialized
> in this function [-Wmaybe-uninitialized]
>   printk(KERN_NOTICE pr_fmt(fmt), ##__VA_ARGS__)
>   ^~~~~~
> drivers/net/ethernet/qlogic/qed/qed_dev.c:983:17: note: 'abs_ppfid' was declared
> here
>   u8 filter_idx, abs_ppfid;
>                  ^~~~~~~~~
> 
> ...under W=1+.
> 
> Fix this by initializing it with zero.
> 
> Fixes: 79284adeb99e ("qed: Add llh ppfid interface and 100g support for
> offload protocols")
> Signed-off-by: Alexander Lobakin <alobakin@marvell.com>
> Signed-off-by: Igor Russkikh <irusskikh@marvell.com>
> Signed-off-by: Michal Kalderon <michal.kalderon@marvell.com>

Please don't wrap Fixes tags:

Fixes tag: Fixes: 79284adeb99e ("qed: Add llh ppfid interface and 100g support for
Has these problem(s):
	- Subject has leading but no trailing parentheses
	- Subject has leading but no trailing quotes
Alexander Lobakin June 23, 2020, 12:16 p.m. UTC | #2
From: Jakub Kicinski <kuba@kernel.org>
Date: Mon, 22 Jun 2020 14:44:37 -0700

> On Mon, 22 Jun 2020 14:14:13 +0300 Alexander Lobakin wrote:
> > Variable 'abs_ppfid' in qed_dev.c:qed_llh_add_mac_filter() always gets
> > printed, but is initialized only under 'ref_cnt == 1' condition. This
> > results in:
> > 
> > In file included from ./include/linux/kernel.h:15:0,
> >                  from ./include/asm-generic/bug.h:19,
> >                  from ./arch/x86/include/asm/bug.h:86,
> >                  from ./include/linux/bug.h:5,
> >                  from ./include/linux/io.h:11,
> >                  from drivers/net/ethernet/qlogic/qed/qed_dev.c:35:
> > drivers/net/ethernet/qlogic/qed/qed_dev.c: In function 'qed_llh_add_mac_filter':
> > ./include/linux/printk.h:358:2: warning: 'abs_ppfid' may be used uninitialized
> > in this function [-Wmaybe-uninitialized]
> >   printk(KERN_NOTICE pr_fmt(fmt), ##__VA_ARGS__)
> >   ^~~~~~
> > drivers/net/ethernet/qlogic/qed/qed_dev.c:983:17: note: 'abs_ppfid' was declared
> > here
> >   u8 filter_idx, abs_ppfid;
> >                  ^~~~~~~~~
> > 
> > ...under W=1+.
> > 
> > Fix this by initializing it with zero.
> > 
> > Fixes: 79284adeb99e ("qed: Add llh ppfid interface and 100g support for
> > offload protocols")
> > Signed-off-by: Alexander Lobakin <alobakin@marvell.com>
> > Signed-off-by: Igor Russkikh <irusskikh@marvell.com>
> > Signed-off-by: Michal Kalderon <michal.kalderon@marvell.com>
> 
> Please don't wrap Fixes tags:

Aww, second time in a row I fail on this. Sorry, will send v2
soon.

> Fixes tag: Fixes: 79284adeb99e ("qed: Add llh ppfid interface and 100g support for
> Has these problem(s):
> 	- Subject has leading but no trailing parentheses
> 	- Subject has leading but no trailing quotes

Al
diff mbox series

Patch

diff --git a/drivers/net/ethernet/qlogic/qed/qed_dev.c b/drivers/net/ethernet/qlogic/qed/qed_dev.c
index b41ada668948..3aa51374e727 100644
--- a/drivers/net/ethernet/qlogic/qed/qed_dev.c
+++ b/drivers/net/ethernet/qlogic/qed/qed_dev.c
@@ -980,7 +980,7 @@  int qed_llh_add_mac_filter(struct qed_dev *cdev,
 	struct qed_hwfn *p_hwfn = QED_LEADING_HWFN(cdev);
 	struct qed_ptt *p_ptt = qed_ptt_acquire(p_hwfn);
 	union qed_llh_filter filter = {};
-	u8 filter_idx, abs_ppfid;
+	u8 filter_idx, abs_ppfid = 0;
 	u32 high, low, ref_cnt;
 	int rc = 0;