From: Renato Westphal Date: Tue, 6 Aug 2019 20:18:41 +0000 (-0300) Subject: isisd: remove unnecessary null checks X-Git-Tag: base_7.2~28^2~2 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=1e4d64aa6ff02a86a50e1211e3649ad44497b01f;p=matthieu%2Ffrr.git isisd: remove unnecessary null checks These null checks don't make sense because a) these two functions are never called with a NULL IP address and b) the same pointers are dereferenced later without any protection. Remove these NULL checks to make the code less confusing. Signed-off-by: Renato Westphal --- diff --git a/isisd/isis_route.c b/isisd/isis_route.c index 238555d154..7059fdb63b 100644 --- a/isisd/isis_route.c +++ b/isisd/isis_route.c @@ -57,7 +57,7 @@ static struct isis_nexthop *isis_nexthop_create(struct in_addr *ip, for (ALL_LIST_ELEMENTS_RO(isis->nexthops, node, nexthop)) { if (nexthop->ifindex != ifindex) continue; - if (ip && memcmp(&nexthop->ip, ip, sizeof(struct in_addr)) != 0) + if (memcmp(&nexthop->ip, ip, sizeof(struct in_addr)) != 0) continue; nexthop->lock++; @@ -123,9 +123,7 @@ static struct isis_nexthop6 *isis_nexthop6_create(struct in6_addr *ip6, for (ALL_LIST_ELEMENTS_RO(isis->nexthops6, node, nexthop6)) { if (nexthop6->ifindex != ifindex) continue; - if (ip6 - && memcmp(&nexthop6->ip6, ip6, sizeof(struct in6_addr)) - != 0) + if (memcmp(&nexthop6->ip6, ip6, sizeof(struct in6_addr)) != 0) continue; nexthop6->lock++;