From e4f71625ed1af07905699c1c1e0012eeca87257a Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Sat, 5 Jun 2021 12:55:48 -0400 Subject: [PATCH 1/2] pathd: Remove unused function format_yang_dnode is never used and it has coverity issues, removing Signed-off-by: Donald Sharp --- pathd/path_pcep_debug.c | 12 ------------ pathd/path_pcep_debug.h | 1 - 2 files changed, 13 deletions(-) diff --git a/pathd/path_pcep_debug.c b/pathd/path_pcep_debug.c index 55148d9d05..e14f6bc4a5 100644 --- a/pathd/path_pcep_debug.c +++ b/pathd/path_pcep_debug.c @@ -975,18 +975,6 @@ const char *format_pcep_message(struct pcep_message *msg) return PATHD_FORMAT_FINI(); } -const char *format_yang_dnode(struct lyd_node *dnode) -{ - char *buff; - int len; - - lyd_print_mem(&buff, dnode, LYD_JSON, LYD_PRINT_WD_ALL); - len = strlen(buff); - memcpy(_debug_buff, buff, len); - free(buff); - return _debug_buff; -} - void _format_pcc_opts(int ps, struct pcc_opts *opts) { if (opts == NULL) { diff --git a/pathd/path_pcep_debug.h b/pathd/path_pcep_debug.h index 5a504e4e1a..bc78c21d4a 100644 --- a/pathd/path_pcep_debug.h +++ b/pathd/path_pcep_debug.h @@ -51,6 +51,5 @@ const char *format_ctrl_state(struct ctrl_state *state); const char *format_path(struct path *path); const char *format_pcep_event(pcep_event *event); const char *format_pcep_message(struct pcep_message *msg); -const char *format_yang_dnode(struct lyd_node *dnode); #endif // _PATH_PCEP_DEBUG_H_ From c0d950a0ae6bd9c10e86f1d564df17075fcca71e Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Sat, 5 Jun 2021 12:57:55 -0400 Subject: [PATCH 2/2] bgpd: bgp_vrf has already been derefed in all paths Coverity scan found this issue. The bgp_vrf variable in ensure_vrf_tovpn_sid() has already been derefed in all paths at this point in time. No need to check for it existing at this point. Signed-off-by: Donald Sharp --- bgpd/bgp_mplsvpn.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bgpd/bgp_mplsvpn.c b/bgpd/bgp_mplsvpn.c index f99d672c8a..564424a082 100644 --- a/bgpd/bgp_mplsvpn.c +++ b/bgpd/bgp_mplsvpn.c @@ -583,7 +583,7 @@ void ensure_vrf_tovpn_sid(struct bgp *bgp_vpn, struct bgp *bgp_vrf, afi_t afi) * skip when bgp vpn instance ins't allocated * or srv6 locator chunk isn't allocated */ - if (!bgp_vpn || !bgp_vpn->srv6_locator_chunks || !bgp_vrf) + if (!bgp_vpn || !bgp_vpn->srv6_locator_chunks) return; tovpn_sid_index = bgp_vrf->vpn_policy[afi].tovpn_sid_index;