Commit 401481e0 authored by Arnd Bergmann's avatar Arnd Bergmann Committed by David S. Miller

ipv6: fix false-postive maybe-uninitialized warning

Adding a lock around one of the assignments prevents gcc from
tracking the state of the local 'fibmatch' variable, so it can no
longer prove that 'dst' is always initialized, leading to a bogus
warning:

net/ipv6/route.c: In function 'inet6_rtm_getroute':
net/ipv6/route.c:3659:2: error: 'dst' may be used uninitialized in this function [-Werror=maybe-uninitialized]

This moves the other assignment into the same lock to shut up the
warning.

Fixes: 121622db ("ipv6: route: make rtm_getroute not assume rtnl is locked")
Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 66ff5fa0
...@@ -3624,6 +3624,8 @@ static int inet6_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr *nlh, ...@@ -3624,6 +3624,8 @@ static int inet6_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr *nlh,
if (!fibmatch) if (!fibmatch)
dst = ip6_route_input_lookup(net, dev, &fl6, flags); dst = ip6_route_input_lookup(net, dev, &fl6, flags);
else
dst = ip6_route_lookup(net, &fl6, 0);
rcu_read_unlock(); rcu_read_unlock();
} else { } else {
...@@ -3631,10 +3633,10 @@ static int inet6_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr *nlh, ...@@ -3631,10 +3633,10 @@ static int inet6_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr *nlh,
if (!fibmatch) if (!fibmatch)
dst = ip6_route_output(net, NULL, &fl6); dst = ip6_route_output(net, NULL, &fl6);
else
dst = ip6_route_lookup(net, &fl6, 0);
} }
if (fibmatch)
dst = ip6_route_lookup(net, &fl6, 0);
rt = container_of(dst, struct rt6_info, dst); rt = container_of(dst, struct rt6_info, dst);
if (rt->dst.error) { if (rt->dst.error) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment