Skip to contentSkip to conversation

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

DISCUSSION Stephen Rothwell 2 participants 2 messages Mar 24, 2019

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

Hi all,

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

net/core/filter.c: In function 'bpf_skb_adjust_room':
net/core/filter.c:3022:31: warning: 'inner_trans' may be used uninitialized in this function [-Wmaybe-uninitialized]
skb->inner_transport_header = inner_trans;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
net/core/filter.c:2979:26: note: 'inner_trans' was declared here

  u16 mac_len, inner_net, inner_trans;
                          ^~~~~~~~~~~

net/core/filter.c:3021:29: warning: 'inner_net' may be used uninitialized in this function [-Wmaybe-uninitialized]
skb->inner_network_header = inner_net;
~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~
net/core/filter.c:2979:15: note: 'inner_net' was declared here

  u16 mac_len, inner_net, inner_trans;
               ^~~~~~~~~

net/core/filter.c:3026:3: warning: 'mac_len' may be used uninitialized in this function [-Wmaybe-uninitialized]
skb_set_network_header(skb, mac_len);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/core/filter.c:2979:6: note: 'mac_len' was declared here

  u16 mac_len, inner_net, inner_trans;
      ^~~~~~~

Introduced by commit

868d523535c2 ("bpf: add bpf_skb_adjust_room encap flags")

This looks like a false positive, it seems that they are only set and used when encap is true.

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

Hi all,

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

net/core/filter.c: In function 'bpf_skb_adjust_room':
net/core/filter.c:3022:31: warning: 'inner_trans' may be used uninitialized in this function [-Wmaybe-uninitialized]

   skb->inner_transport_header = inner_trans;
   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
net/core/filter.c:2979:26: note: 'inner_trans' was declared here
  u16 mac_len, inner_net, inner_trans;
                          ^~~~~~~~~~~
net/core/filter.c:3021:29: warning: 'inner_net' may be used uninitialized in this function [-Wmaybe-uninitialized]
   skb->inner_network_header = inner_net;
   ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~
net/core/filter.c:2979:15: note: 'inner_net' was declared here
  u16 mac_len, inner_net, inner_trans;
               ^~~~~~~~~
net/core/filter.c:3026:3: warning: 'mac_len' may be used uninitialized in this function [-Wmaybe-uninitialized]
   skb_set_network_header(skb, mac_len);
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/core/filter.c:2979:6: note: 'mac_len' was declared here
  u16 mac_len, inner_net, inner_trans;
      ^~~~~~~
Quoted 7 lines

Introduced by commit

868d523535c2 ("bpf: add bpf_skb_adjust_room encap flags")

This looks like a false positive, it seems that they are only set and used when encap is true.

Indeed. Sorry about that.

The fix for this is now in bpf-next, commit 62b31b42cff9 ("bpf:
silence uninitialized var warning in bpf_skb_net_grow").