]> git.proxmox.com Git - mirror_frr.git/commitdiff
zebra: Rework code to make SA happy
authorDonald Sharp <sharpd@nvidia.com>
Wed, 4 Nov 2020 16:48:49 +0000 (11:48 -0500)
committerDonald Sharp <sharpd@nvidia.com>
Wed, 4 Nov 2020 16:48:49 +0000 (11:48 -0500)
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 <sharpd@nvidia.com>
zebra/zebra_vty.c

index df0e22b40c0ef5e39a6e2b05699b8eff240426be..ab7d2845e73603c29c50d2bf37c1b62df60c2d2c 100644 (file)
@@ -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)