]> git.puffer.fish Git - matthieu/frr.git/commitdiff
*: fix clang-6 SA warnings
authorDavid Lamparter <equinox@opensourcerouting.org>
Sat, 8 Sep 2018 18:16:59 +0000 (20:16 +0200)
committerDavid Lamparter <equinox@opensourcerouting.org>
Sat, 8 Sep 2018 18:34:35 +0000 (20:34 +0200)
I don't see these in CI, but my local clang-6 does emit warnings for
these.

Signed-off-by: David Lamparter <equinox@diac24.net>
lib/command.c
lib/csv.c
ospf6d/ospf6_asbr.c
ospf6d/ospf6_route.c
ospfd/ospf_snmp.c
staticd/static_vty.c
zebra/zebra_fpm_protobuf.c

index 1df644210723a3e7ec47ad382bf79940d08c5d82..3cc6806a88a5582443fa6d44c44846b69b89ee5d 100644 (file)
@@ -1197,6 +1197,7 @@ static int handle_pipe_action(struct vty *vty, const char *cmd_in,
 
        /* retrieve action */
        token = strsep(&working, " ");
+       assert(token);
 
        /* match result to known actions */
        if (strmatch(token, "include")) {
index ce84783aa6f7570da98027cabbc489a8cf1cd4b6..2752974df57408ad509bd9e1262b90b85dda425f 100644 (file)
--- a/lib/csv.c
+++ b/lib/csv.c
@@ -563,6 +563,8 @@ void csv_decode(csv_t *csv, char *inbuf)
        csv_record_t *rec;
 
        buf = (inbuf) ? inbuf : csv->buf;
+       assert(buf);
+
        pos = strpbrk(buf, "\n");
        while (pos != NULL) {
                rec = calloc(1, sizeof(csv_record_t));
index 5af88defeba69dc6a65251900ff33c61567a5db1..dc7a3f6d45766c8f8b848b45273fbdcab741a6da 100644 (file)
@@ -732,7 +732,8 @@ void ospf6_asbr_lsa_remove(struct ospf6_lsa *lsa,
                                                        ? 1
                                                        : 2,
                                                buf, listcount(route->paths),
-                                               listcount(route->nh_list));
+                                               route->nh_list ?
+                                               listcount(route->nh_list) : 0);
                                }
 
                                if (listcount(route->paths)) {
index a099eead49bab5bf718a24ec3901b28f5f6a9bdc..021e825ae33dc82a27de356081d523d06f2b3cee 100644 (file)
@@ -732,7 +732,7 @@ struct ospf6_route *ospf6_route_add(struct ospf6_route *route,
                route->next = next;
 
                if (node->info == next) {
-                       assert(next->rnode == node);
+                       assert(next && next->rnode == node);
                        node->info = route;
                        UNSET_FLAG(next->flag, OSPF6_ROUTE_BEST);
                        SET_FLAG(route->flag, OSPF6_ROUTE_BEST);
index 19d2e6a95251f4fb1de862a5c56bda0105842370..755634a2f166c5d2d9935351a016a71a7b1b3cc1 100644 (file)
@@ -995,7 +995,6 @@ static struct ospf_lsa *ospfLsdbLookup(struct variable *v, oid *name,
                        if (len <= 0)
                                type_next = 1;
                        else {
-                               len = 1;
                                type_next = 0;
                                *type = *offset;
                        }
index b323612d7e377294be6259d01d95416e2088e416..f697969a7227d34faae573098b5a67d706124d84 100644 (file)
@@ -88,8 +88,8 @@ static struct list *static_list;
 
 static int static_list_compare_helper(const char *s1, const char *s2)
 {
-       /* Are Both NULL */
-       if (s1 == s2)
+       /* extra (!s1 && !s2) to keep SA happy */
+       if (s1 == s2 || (!s1 && !s2))
                return 0;
 
        if (!s1 && s2)
index ebd632270c7d004b855799e55fcd3c2776a3dcd7..be0f6a23be74224f4a83756306b5b30e784d4323 100644 (file)
@@ -129,6 +129,7 @@ static inline int add_nexthop(qpb_allocator_t *allocator, Fpm__AddRoute *msg,
        }
 
        // TODO: Use src.
+       (void)src;
 
        return 1;
 }