From ea8b2282869d6c4a1626be98e0a6c883e48ab314 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Sat, 6 Apr 2019 19:53:55 -0400 Subject: [PATCH] bgpd: pi->peer assignment exists no need for null check The creation of a new `struct bgp_path_info` requires a legitimate peer being passed in for creation. There exists no code paths where this is not true. As such checking pi->peer for null convinces SA that it might happen. Signed-off-by: Donald Sharp --- bgpd/bgp_route.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index ad9d22a7a5..555a085522 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -1941,7 +1941,7 @@ void bgp_best_selection(struct bgp *bgp, struct bgp_node *rn, continue; if (BGP_PATH_HOLDDOWN(pi1)) continue; - if (pi1->peer && pi1->peer != bgp->peer_self) + if (pi1->peer != bgp->peer_self) if (pi1->peer->status != Established) continue; @@ -1953,11 +1953,10 @@ void bgp_best_selection(struct bgp *bgp, struct bgp_node *rn, continue; if (BGP_PATH_HOLDDOWN(pi2)) continue; - if (pi2->peer - && pi2->peer != bgp->peer_self + if (pi2->peer != bgp->peer_self && !CHECK_FLAG( - pi2->peer->sflags, - PEER_STATUS_NSF_WAIT)) + pi2->peer->sflags, + PEER_STATUS_NSF_WAIT)) if (pi2->peer->status != Established) continue; -- 2.39.5