Skip to content

Commit

Permalink
arp: fixed -Wuninitialized compiler warning
Browse files Browse the repository at this point in the history
Commit 7d472a5 ("arp: always override
existing neigh entries with gratuitous ARP") introduced a compiler
warning:

net/ipv4/arp.c:880:35: warning: 'addr_type' may be used uninitialized in
this function [-Wmaybe-uninitialized]

While the code logic seems to be correct and doesn't allow the variable
to be used uninitialized, and the warning is not consistently
reproducible, it's still worth fixing it for other people not to waste
time looking at the warning in case it pops up in the build environment.
Yes, compiler is probably at fault, but we will need to accommodate.

Fixes: 7d472a5 ("arp: always override existing neigh entries with gratuitous ARP")
Signed-off-by: Ihar Hrachyshka <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
booxter authored and davem330 committed May 25, 2017
1 parent ba615f6 commit 5990baa
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion net/ipv4/arp.c
Original file line number Diff line number Diff line change
Expand Up @@ -863,8 +863,8 @@ static int arp_process(struct net *net, struct sock *sk, struct sk_buff *skb)

n = __neigh_lookup(&arp_tbl, &sip, dev, 0);

addr_type = -1;
if (n || IN_DEV_ARP_ACCEPT(in_dev)) {
addr_type = -1;
is_garp = arp_is_garp(net, dev, &addr_type, arp->ar_op,
sip, tip, sha, tha);
}
Expand Down

0 comments on commit 5990baa

Please sign in to comment.