From 1e4d64aa6ff02a86a50e1211e3649ad44497b01f Mon Sep 17 00:00:00 2001 From: Renato Westphal Date: Tue, 6 Aug 2019 17:18:41 -0300 Subject: [PATCH] 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 --- isisd/isis_route.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) 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++; -- 2.39.5