]> git.puffer.fish Git - matthieu/frr.git/commitdiff
bgpd: community_list_set str is always non null
authorDonald Sharp <sharpd@nvidia.com>
Tue, 30 May 2023 23:30:12 +0000 (19:30 -0400)
committerDonald Sharp <sharpd@nvidia.com>
Thu, 1 Jun 2023 12:54:25 +0000 (08:54 -0400)
When calling community_list_set the str variable is
always non NULL.  As such let's treat it as such.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
bgpd/bgp_clist.c
bgpd/bgp_vty.c

index 1d2ba3bf5845eff39742cd91bff8670c8b5545d9..ac5cdd6acba532ae8fd221fcab0d40616401248e 100644 (file)
@@ -899,15 +899,13 @@ int community_list_set(struct community_list_handler *ch, const char *name,
                }
        }
 
-       if (str) {
-               if (style == COMMUNITY_LIST_STANDARD)
-                       com = community_str2com(str);
-               else
-                       regex = bgp_regcomp(str);
+       if (style == COMMUNITY_LIST_STANDARD)
+               com = community_str2com(str);
+       else
+               regex = bgp_regcomp(str);
 
-               if (!com && !regex)
-                       return COMMUNITY_LIST_ERR_MALFORMED_VAL;
-       }
+       if (!com && !regex)
+               return COMMUNITY_LIST_ERR_MALFORMED_VAL;
 
        entry = community_entry_new();
        entry->direct = direct;
index 7ef9db9f0dd8e60040399fd386f1316d2cdc91d7..89a5333a2ca8aeefd2abc57c63753559437a8705 100644 (file)
@@ -20663,6 +20663,7 @@ DEFUN (community_list_standard,
        argv_find(argv, argc, "AA:NN", &idx);
        char *str = argv_concat(argv, argc, idx);
 
+       assert(str);
        int ret = community_list_set(bgp_clist, cl_name_or_number, str, seq,
                                     direct, style);
 
@@ -20775,6 +20776,7 @@ DEFUN (community_list_expanded_all,
        argv_find(argv, argc, "AA:NN", &idx);
        char *str = argv_concat(argv, argc, idx);
 
+       assert(str);
        int ret = community_list_set(bgp_clist, cl_name_or_number, str, seq,
                                     direct, style);