Re: net: vrf: Handle ipv6 multicast and link-local addresses

From: Geert Uytterhoeven
Date: Thu Aug 04 2016 - 05:43:31 EST


Hi David,

On Thu, Aug 4, 2016 at 7:01 AM, David Ahern <dsa@xxxxxxxxxxxxxxxxxxx> wrote:
> Does making the code the same between those 2 functions matter?

Yes, it does make the warning go away.

> diff --git a/drivers/net/vrf.c b/drivers/net/vrf.c
> index 1ce7420322ee..3951a2c98431 100644
> --- a/drivers/net/vrf.c
> +++ b/drivers/net/vrf.c
> @@ -862,15 +862,17 @@ static void vrf_ip6_input_dst(struct sk_buff *skb, struct net_device *vrf_dev,
> int ifindex)
> {
> const struct ipv6hdr *iph = ipv6_hdr(skb);
> + struct net *net = dev_net(vrf_dev);
> struct flowi6 fl6 = {
> + .flowi6_oif = 0,
> + .flowi6_iif = ifindex,
> .daddr = iph->daddr,
> .saddr = iph->saddr,
> .flowlabel = ip6_flowinfo(iph),
> .flowi6_mark = skb->mark,
> .flowi6_proto = iph->nexthdr,
> - .flowi6_iif = ifindex,
> + .flowi6_flags = 0,
> };
> - struct net *net = dev_net(vrf_dev);
> struct rt6_info *rt6;

The critical change seems to be moving the initialization of
.flowi6_iif: if that
is done before the initialization of .flowlabel, there's no compiler warning.

The generated asm output is identical, though, so I think this is some sort of
false positive or compiler bug. Hence let's ignore it.

Thanks!

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds