mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-07-01 11:21:51 +00:00
ipv6: Fix bug in ipv6_chk_same_addr().
hlist_for_each_entry(p...) will not necessarily initialize 'p' to anything if the hlist is empty. GCC notices this and emits a warning. Just return true explicitly when we hit a match, and return false is we fall out of the loop without one. Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
b2db756449
commit
3e81c6da39
1 changed files with 7 additions and 8 deletions
|
@ -155,7 +155,7 @@ static void ipv6_ifa_notify(int event, struct inet6_ifaddr *ifa);
|
||||||
|
|
||||||
static void inet6_prefix_notify(int event, struct inet6_dev *idev,
|
static void inet6_prefix_notify(int event, struct inet6_dev *idev,
|
||||||
struct prefix_info *pinfo);
|
struct prefix_info *pinfo);
|
||||||
static int ipv6_chk_same_addr(struct net *net, const struct in6_addr *addr,
|
static bool ipv6_chk_same_addr(struct net *net, const struct in6_addr *addr,
|
||||||
struct net_device *dev);
|
struct net_device *dev);
|
||||||
|
|
||||||
static ATOMIC_NOTIFIER_HEAD(inet6addr_chain);
|
static ATOMIC_NOTIFIER_HEAD(inet6addr_chain);
|
||||||
|
@ -1295,23 +1295,22 @@ int ipv6_chk_addr(struct net *net, struct in6_addr *addr,
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(ipv6_chk_addr);
|
EXPORT_SYMBOL(ipv6_chk_addr);
|
||||||
|
|
||||||
static
|
static bool ipv6_chk_same_addr(struct net *net, const struct in6_addr *addr,
|
||||||
int ipv6_chk_same_addr(struct net *net, const struct in6_addr *addr,
|
|
||||||
struct net_device *dev)
|
struct net_device *dev)
|
||||||
{
|
{
|
||||||
|
unsigned int hash = ipv6_addr_hash(addr);
|
||||||
struct inet6_ifaddr *ifp;
|
struct inet6_ifaddr *ifp;
|
||||||
struct hlist_node *node;
|
struct hlist_node *node;
|
||||||
unsigned int hash = ipv6_addr_hash(addr);
|
|
||||||
|
|
||||||
hlist_for_each_entry(ifp, node, &inet6_addr_lst[hash], addr_lst) {
|
hlist_for_each_entry(ifp, node, &inet6_addr_lst[hash], addr_lst) {
|
||||||
if (!net_eq(dev_net(ifp->idev->dev), net))
|
if (!net_eq(dev_net(ifp->idev->dev), net))
|
||||||
continue;
|
continue;
|
||||||
if (ipv6_addr_equal(&ifp->addr, addr)) {
|
if (ipv6_addr_equal(&ifp->addr, addr)) {
|
||||||
if (dev == NULL || ifp->idev->dev == dev)
|
if (dev == NULL || ifp->idev->dev == dev)
|
||||||
break;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ifp != NULL;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ipv6_chk_prefix(struct in6_addr *addr, struct net_device *dev)
|
int ipv6_chk_prefix(struct in6_addr *addr, struct net_device *dev)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue