]> git.puffer.fish Git - matthieu/frr.git/commitdiff
ldpd: sprinkle in some asserts to make scan-build happy
authorRenato Westphal <renato@opensourcerouting.org>
Fri, 6 Oct 2017 20:50:19 +0000 (17:50 -0300)
committerRenato Westphal <renato@opensourcerouting.org>
Fri, 6 Oct 2017 20:50:19 +0000 (17:50 -0300)
While here, fix the other SA warnings.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
ldpd/address.c
ldpd/interface.c
ldpd/labelmapping.c
ldpd/lde.c
ldpd/lde_lib.c
ldpd/ldpd.c
ldpd/ldpe.c

index 18ab03776057279d1d91b468787b53eabb3668ce..12356a0b49e0209a37a40d23308de7437bc272c5 100644 (file)
@@ -98,6 +98,7 @@ send_address(struct nbr *nbr, int af, struct if_addr_head *addr_list,
                        log_msg_address(1, msg_type, nbr, af, &if_addr->addr);
 
                        LIST_REMOVE(if_addr, entry);
+                       assert(if_addr != LIST_FIRST(addr_list));
                        free(if_addr);
                        if (--tlv_addr_count == 0)
                                break;
@@ -168,7 +169,6 @@ send_mac_withdrawal(struct nbr *nbr, struct map *fec, uint8_t *mac)
        err = gen_ldp_hdr(buf, size);
        size -= LDP_HDR_SIZE;
        err |= gen_msg_hdr(buf, MSG_TYPE_ADDRWITHDRAW, size);
-       size -= LDP_MSG_SIZE;
        err |= gen_address_list_tlv(buf, AF_INET, NULL, 0);
        err |= gen_fec_tlv(buf, fec);
        err |= gen_mac_list_tlv(buf, mac);
@@ -400,6 +400,7 @@ address_list_clr(struct if_addr_head *addr_list)
 
        while ((if_addr = LIST_FIRST(addr_list)) != NULL) {
                LIST_REMOVE(if_addr, entry);
+               assert(if_addr != LIST_FIRST(addr_list));
                free(if_addr);
        }
 }
index a18019c0c152d87ce6faf6d2f21145c7c48fbe70..bbcea9f553495904a1513279b8a9e750bbe29538 100644 (file)
@@ -103,6 +103,7 @@ ldpe_if_exit(struct iface *iface)
 
        while ((if_addr = LIST_FIRST(&iface->addr_list)) != NULL) {
                LIST_REMOVE(if_addr, entry);
+               assert(if_addr != LIST_FIRST(&iface->addr_list));
                free(if_addr);
        }
 }
index f53bc8333d7cbd81deb9a9919bff72b38926f4dd..5662038a58528cca6418f737541c2d0c717ccc08 100644 (file)
@@ -130,6 +130,7 @@ send_labelmessage(struct nbr *nbr, uint16_t type, struct mapping_head *mh)
                }
 
                TAILQ_REMOVE(mh, me, entry);
+               assert(me != TAILQ_FIRST(mh));
                free(me);
        }
 
@@ -459,6 +460,7 @@ recv_labelmessage(struct nbr *nbr, char *buf, uint16_t len, uint16_t type)
 
  next:
                TAILQ_REMOVE(&mh, me, entry);
+               assert(me != TAILQ_FIRST(&mh));
                free(me);
        }
 
index 3482f3d7226d95447ce80f95ffdac73f7f664952..648eefa6530bf25eace9256c0324daf9d14f7fbc 100644 (file)
@@ -429,7 +429,7 @@ lde_dispatch_parent(struct thread *thread)
        struct imsg              imsg;
        struct kif              *kif;
        struct kroute           *kr;
-       int                      fd = THREAD_FD(thread);
+       int                      fd;
        struct imsgev           *iev = THREAD_ARG(thread);
        struct imsgbuf          *ibuf = &iev->ibuf;
        ssize_t                  n;
index c56b7e33d096c56acddc49719fe99eb0915aceb1..18c8c0a1229a31894ca97e5aef71015affa10500 100644 (file)
@@ -229,8 +229,10 @@ fec_free(void *arg)
        struct fec_node *fn = arg;
        struct fec_nh   *fnh;
 
-       while ((fnh = LIST_FIRST(&fn->nexthops)))
+       while ((fnh = LIST_FIRST(&fn->nexthops))) {
                fec_nh_del(fnh);
+               assert(fnh != LIST_FIRST(&fn->nexthops));
+       }
        if (!RB_EMPTY(lde_map_head, &fn->downstream))
                log_warnx("%s: fec %s downstream list not empty", __func__,
                    log_fec(&fn->fec));
index 843d160d626ae40cb8660b1be018e8fa028511ec..12aeb1fff32afaa46f01a6b685fe9833e5dc4c0e 100644 (file)
@@ -260,7 +260,6 @@ main(int argc, char *argv[])
            sizeof(init.zclient_serv_path));
 
        argc -= optind;
-       argv += optind;
        if (argc > 0 || (lflag && eflag))
                frr_help_exit(1);
 
index 1c0a8bdc84fd83d14d87646ea524984ce9c5907b..3c8f8135e9d0ceacf8e2f87171e1c0e705352973 100644 (file)
@@ -215,6 +215,7 @@ ldpe_shutdown(void)
        /* remove addresses from global list */
        while ((if_addr = LIST_FIRST(&global.addr_list)) != NULL) {
                LIST_REMOVE(if_addr, entry);
+               assert(if_addr != LIST_FIRST(&global.addr_list));
                free(if_addr);
        }
        while ((adj = RB_ROOT(global_adj_head, &global.adj_tree)) != NULL)
@@ -265,7 +266,7 @@ ldpe_dispatch_main(struct thread *thread)
        struct l2vpn_if         *lif, *nlif;
        struct l2vpn_pw         *pw, *npw;
        struct imsg              imsg;
-       int                      fd = THREAD_FD(thread);
+       int                      fd;
        struct imsgev           *iev = THREAD_ARG(thread);
        struct imsgbuf          *ibuf = &iev->ibuf;
        struct iface            *iface = NULL;
@@ -964,6 +965,7 @@ mapping_list_clr(struct mapping_head *mh)
 
        while ((me = TAILQ_FIRST(mh)) != NULL) {
                TAILQ_REMOVE(mh, me, entry);
+               assert(me != TAILQ_FIRST(mh));
                free(me);
        }
 }