From 6447dbb3726089659be4c891be8b2db39031791a Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Tue, 13 Feb 2018 23:39:09 -0500 Subject: [PATCH] zebra: Clean up some SA issues found by new code 1) Add asserts in a couple of spots to show we never expect prefix to be bad. 2) Fix some bfd code where out_ctxt will always be NULL. Signed-off-by: Donald Sharp --- zebra/zebra_ptm.c | 9 +++++++-- zebra/zebra_vty.c | 12 ++++++++++++ 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/zebra/zebra_ptm.c b/zebra/zebra_ptm.c index 7f5fd472f1..187c2594ad 100644 --- a/zebra/zebra_ptm.c +++ b/zebra/zebra_ptm.c @@ -1007,8 +1007,13 @@ int zebra_ptm_bfd_client_register(struct zserv *client, return 0; stream_failure: - if (out_ctxt) - ptm_lib_cleanup_msg(ptm_hdl, out_ctxt); + /* + * IF we ever add more STREAM_GETXXX functions after the out_ctxt + * is allocated then we need to add this code back in + * + * if (out_ctxt) + * ptm_lib_cleanup_msg(ptm_hdl, out_ctxt); + */ return 0; } diff --git a/zebra/zebra_vty.c b/zebra/zebra_vty.c index f5ad9c1c8a..269244f768 100644 --- a/zebra/zebra_vty.c +++ b/zebra/zebra_vty.c @@ -458,6 +458,12 @@ DEFPY(ip_route_blackhole_vrf, VTY_DECLVAR_CONTEXT(vrf, vrf); struct zebra_vrf *zvrf = vrf->info; + /* + * Coverity is complaining that prefix could + * be dereferenced, but we know that prefix will + * valid. Add an assert to make it happy + */ + assert(prefix); return zebra_static_route_leak(vty, zvrf, zvrf, AFI_IP, SAFI_UNICAST, no, prefix, mask_str, NULL, NULL, NULL, flag, @@ -2014,6 +2020,12 @@ DEFPY(ipv6_route_blackhole_vrf, VTY_DECLVAR_CONTEXT(vrf, vrf); struct zebra_vrf *zvrf = vrf->info; + /* + * Coverity is complaining that prefix could + * be dereferenced, but we know that prefix will + * valid. Add an assert to make it happy + */ + assert(prefix); return zebra_static_route_leak(vty, zvrf, zvrf, AFI_IP6, SAFI_UNICAST, no, prefix_str, NULL, from_str, NULL, NULL, flag, -- 2.39.5