net: route: Do not dereference NULL pointer while getting next hop
Assertions should only be used to check invariants. Things that may change value in runtime are better left to proper checks. Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
This commit is contained in:
parent
5bdb1c2fe7
commit
a53f525830
|
@ -595,12 +595,14 @@ struct in6_addr *net_route_get_nexthop(struct net_route_entry *route)
|
|||
}
|
||||
|
||||
ipv6_nbr_data = net_ipv6_nbr_data(nexthop_route->nbr);
|
||||
NET_ASSERT(ipv6_nbr_data);
|
||||
if (ipv6_nbr_data) {
|
||||
addr = &ipv6_nbr_data->addr;
|
||||
NET_ASSERT(addr);
|
||||
|
||||
addr = &ipv6_nbr_data->addr;
|
||||
NET_ASSERT(addr);
|
||||
|
||||
return addr;
|
||||
return addr;
|
||||
} else {
|
||||
NET_ERR("could not get neighbor data from next hop");
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
|
|
Loading…
Reference in a new issue