From eb9e2865116777661c44963769c1a5fed764b7f9 Mon Sep 17 00:00:00 2001 From: Louis Scalbert Date: Thu, 28 Sep 2023 15:08:23 +0200 Subject: [PATCH] bgpd: do not check attr in bgp_packet_attribute Fix the following coverity issue. attr cannot be NULL. > CID 1568376 (#1 of 1): Dereference before null check (REVERSE_INULL) > check_after_deref: Null-checking attr suggests that it may be null, but it has already been dereferenced on all paths leading to the check. Fixes: 8b531b1107 ("bgpd: store and send bgp link-state attributes") Signed-off-by: Louis Scalbert --- bgpd/bgp_attr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bgpd/bgp_attr.c b/bgpd/bgp_attr.c index cc7afbe74f..05cf63e053 100644 --- a/bgpd/bgp_attr.c +++ b/bgpd/bgp_attr.c @@ -4982,7 +4982,7 @@ bgp_size_t bgp_packet_attribute(struct bgp *bgp, struct peer *peer, } /* BGP Link-State */ - if (attr && attr->link_state) { + if (attr->link_state) { stream_putc(s, BGP_ATTR_FLAG_OPTIONAL); stream_putc(s, BGP_ATTR_LINK_STATE); stream_putc(s, attr->link_state->length); -- 2.39.5