From 9ea714e1436fad8b19253fe695ca5178e659b662 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Wed, 4 Nov 2020 11:48:49 -0500 Subject: [PATCH] zebra: Rework code to make SA happy MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 --- zebra/zebra_vty.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) 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) -- 2.39.5