From: Donald Sharp Date: Wed, 4 Nov 2020 16:48:49 +0000 (-0500) Subject: zebra: Rework code to make SA happy X-Git-Tag: base_7.6~314^2 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=refs%2Fpull%2F7459%2Fhead;p=mirror%2Ffrr.git zebra: Rework code to make SA happy Clan SA was saying: ./zebra/zebra_vty_clippy.c: In function ‘show_route’: zebra/zebra_vty.c:1775:4: warning: ‘zvrf’ may be used uninitialized in this function [-Wmaybe-uninitialized] do_show_ip_route_all(vty, zvrf, afi, !!fib, !!json, tag, ^ I do not see a way that zvrf could ever be uninited in the code path but rearrange the code a tiny bit to make it happier. Signed-off-by: Donald Sharp --- diff --git a/zebra/zebra_vty.c b/zebra/zebra_vty.c index df0e22b40c..ab7d2845e7 100644 --- a/zebra/zebra_vty.c +++ b/zebra/zebra_vty.c @@ -1766,9 +1766,11 @@ DEFPY (show_route, if (vrf_name) VRF_GET_ID(vrf_id, vrf_name, !!json); vrf = vrf_lookup_by_id(vrf_id); - if (vrf) - zvrf = vrf->info; - if (!vrf || !zvrf) + if (!vrf) + return CMD_SUCCESS; + + zvrf = vrf->info; + if (!zvrf) return CMD_SUCCESS; if (table_all)