Skip to contentSkip to conversation

linux-next: build warning after merge of the net-next tree

DISCUSSION Stephen Rothwell 3 participants 5 messages Feb 24, 2020 – Feb 25, 2020

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

Hi all,

After merging the net-next tree, today's linux-next build (x86_64 allmodconfig) produced this warning:

drivers/net/bareudp.c: In function 'bareudp_xmit_skb':
drivers/net/bareudp.c:346:9: warning: 'err' may be used uninitialized in this function [-Wmaybe-uninitialized]

  346 |  return err;
      |         ^~~
drivers/net/bareudp.c: In function 'bareudp6_xmit_skb':
drivers/net/bareudp.c:407:9: warning: 'err' may be used uninitialized in this function [-Wmaybe-uninitialized]
  407 |  return err;
      |         ^~~

Introduced by commit

571912c69f0e ("net: UDP tunnel encapsulation module for tunnelling different protocols like MPLS, IP, NSH etc.")

These are not false positives.

Signature · 2 lines
Cheers,
Stephen Rothwell
maintainer
#1 lore raw

From: Stephen Rothwell <[email protected]>
Date: Tue, 25 Feb 2020 09:27:36 +1100

Quoted 12 lines

After merging the net-next tree, today's linux-next build (x86_64 allmodconfig) produced this warning:

drivers/net/bareudp.c: In function 'bareudp_xmit_skb':
drivers/net/bareudp.c:346:9: warning: 'err' may be used uninitialized in this function [-Wmaybe-uninitialized]

  346 |  return err;
      |         ^~~
drivers/net/bareudp.c: In function 'bareudp6_xmit_skb':
drivers/net/bareudp.c:407:9: warning: 'err' may be used uninitialized in this function [-Wmaybe-uninitialized]
  407 |  return err;
      |         ^~~
Quoted 3 lines

Introduced by commit

571912c69f0e ("net: UDP tunnel encapsulation module for tunnelling different protocols like MPLS, IP, NSH etc.")

Sorry, my compiler didn't show this.

I've committed the following into net-next, hopefully it does the trick:

====================
[PATCH] bareudp: Fix uninitialized variable warnings.

drivers/net/bareudp.c: In function 'bareudp_xmit_skb':
drivers/net/bareudp.c:346:9: warning: 'err' may be used uninitialized in this function [-Wmaybe-uninitialized]

  346 |  return err;
      |         ^~~

drivers/net/bareudp.c: In function 'bareudp6_xmit_skb':
drivers/net/bareudp.c:407:9: warning: 'err' may be used uninitialized in this function [-Wmaybe-uninitialized]
407 | return err;

---
 drivers/net/bareudp.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/net/bareudp.c +2 -0
index 77e72477499d..15337e9d4fad 100644
@@ -320,6 +320,7 @@ static int bareudp_xmit_skb(struct sk_buff *skb, struct net_device *dev,
 	df = key->tun_flags & TUNNEL_DONT_FRAGMENT ? htons(IP_DF) : 0;
 	skb_scrub_packet(skb, xnet);
 
+	err = -ENOSPC;
 	if (!skb_pull(skb, skb_network_offset(skb)))
 		goto free_dst;
 
@@ -381,6 +382,7 @@ static int bareudp6_xmit_skb(struct sk_buff *skb, struct net_device *dev,
 
 	skb_scrub_packet(skb, xnet);
 
+	err = -ENOSPC;
 	if (!skb_pull(skb, skb_network_offset(skb)))
 		goto free_dst;
 
Signature · 1 line
2.21.1
#2 lore raw

Hi Dave,

Quoted 2 lines · On Mon, 24 Feb 2020 14:42:43 -0800 (PST) David Miller <[email protected]>…

Sorry, my compiler didn't show this.

Yeah, these ones especially change with compiler version. I am currently running gcc v9.2.1 if it matters.

Quoted 1 line

I've committed the following into net-next, hopefully it does the trick:

Thanks.

Signature · 2 lines
Cheers,
Stephen Rothwell
#3 lore raw

HI David & Stephen,

In v8 version of patch while fixing reverse xmas tree I wrongly judged the variable usage and removed the initialization. But wondering why compiler didn't show me that. Apologies. David, Thanks for fixing it.

Regards,
Martin

-----Original Message-----
From: Stephen Rothwell <[email protected]>
Sent: Tuesday, February 25, 2020 4:17 AM
To: David Miller <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; Varghese, Martin (Nokia - IN/Bangalore) <[email protected]>; [email protected]
Subject: Re: linux-next: build warning after merge of the net-next tree

Hi Dave,

Quoted 2 lines · On Mon, 24 Feb 2020 14:42:43 -0800 (PST) David Miller <[email protected]>…

Sorry, my compiler didn't show this.

Yeah, these ones especially change with compiler version. I am currently running gcc v9.2.1 if it matters.

Quoted 1 line

I've committed the following into net-next, hopefully it does the trick:

Thanks.

--
Cheers,
Stephen Rothwell

#4 lore raw
In reply to David Miller

Hi Dave,

Quoted 2 lines · On Mon, 24 Feb 2020 14:42:43 -0800 (PST) David Miller <[email protected]>…

I've committed the following into net-next, hopefully it does the trick:

That fixed the warnings for me, thanks.

Signature · 2 lines
Cheers,
Stephen Rothwell