]> git.puffer.fish Git - mirror/frr.git/commitdiff
isisd: address coverity findings 201/head
authorChristian Franke <chris@opensourcerouting.org>
Mon, 13 Feb 2017 18:27:54 +0000 (19:27 +0100)
committerChristian Franke <chris@opensourcerouting.org>
Mon, 13 Feb 2017 18:27:54 +0000 (19:27 +0100)
isisd/dict.c
isisd/isis_circuit.c
isisd/isis_lsp.c
isisd/isis_pdu.c
isisd/isis_route.c
isisd/isis_te.c

index a038028d226a9fdd629b33adf7196bdfb2b65d47..56676edaf13a79bd8dcfe1a70ff2b348ae2f2fb5 100644 (file)
@@ -649,6 +649,7 @@ dnode_t *dict_delete(dict_t *dict, dnode_t *delete)
 
     if (delete->left != nil && delete->right != nil) {
        dnode_t *next = dict_next(dict, delete);
+       assert (next);
        dnode_t *nextparent = next->parent;
        dnode_color_t nextcolor = next->color;
 
index 0ea6c3d4534bb276af3eedd533590304a9255334..3a89766b2feec2abec1669b2ada4ef424f1ffb60 100644 (file)
@@ -308,12 +308,12 @@ isis_circuit_del_addr (struct isis_circuit *circuit,
       else
        {
          prefix2str (connected->address, buf, sizeof (buf));
-         zlog_warn ("Nonexitant ip address %s removal attempt from \
+         zlog_warn ("Nonexistant ip address %s removal attempt from \
                       circuit %d", buf, circuit->circuit_id);
          zlog_warn ("Current ip addresses on %s:", circuit->interface->name);
          for (ALL_LIST_ELEMENTS_RO(circuit->ip_addrs, node, ip))
            {
-             prefix2str((struct prefix*)ip, (char *)buf, BUFSIZ);
+             prefix2str(ip, buf, sizeof(buf));
              zlog_warn("  %s", buf);
            }
          zlog_warn("End of addresses");
index c13bcc5d8a44ebcda31b31fa88bdaa2b2051e1b9..a710c00e5fc99d96b7f6686a7dacc100d1c0da8b 100644 (file)
@@ -2484,8 +2484,7 @@ lsp_regenerate_schedule_pseudo (struct isis_circuit *circuit, int level)
   int lvl;
   struct isis_area *area = circuit->area;
 
-  if (circuit == NULL ||
-      circuit->circ_type != CIRCUIT_T_BROADCAST ||
+  if (circuit->circ_type != CIRCUIT_T_BROADCAST ||
       circuit->state != C_STATE_UP)
     return ISIS_OK;
 
index 96e459a79736f8b5e2b6a914bf91e99aa40dd43a..114c05bec0b295b283d080e15f81f7eb1f19b8bf 100644 (file)
@@ -2430,7 +2430,7 @@ send_lan_l1_hello (struct thread *thread)
     }
 
   if (circuit->u.bc.run_dr_elect[0])
-    retval = isis_dr_elect (circuit, 1);
+    isis_dr_elect (circuit, 1);
 
   retval = send_hello (circuit, 1);
 
@@ -2460,7 +2460,7 @@ send_lan_l2_hello (struct thread *thread)
     }
 
   if (circuit->u.bc.run_dr_elect[1])
-    retval = isis_dr_elect (circuit, 2);
+    isis_dr_elect (circuit, 2);
 
   retval = send_hello (circuit, 2);
 
index cc3ecba0d3b4353daac2f47ebc9a876ce39917f8..101d40dba330194a6d064aa00c519ed48dffbdb7 100644 (file)
@@ -585,10 +585,14 @@ isis_route_validate_merge (struct isis_area *area, int family)
 
   if (family == AF_INET)
     table = area->route_table[0];
-#ifdef HAVE_IPV6
   else if (family == AF_INET6)
     table = area->route_table6[0];
-#endif
+  else
+    {
+      zlog_warn ("ISIS-Rte (%s) %s called for unknown family %d",
+                 area->area_tag, __func__, family);
+      return;
+    }
 
   for (rnode = route_top (table); rnode; rnode = route_next (rnode))
     {
@@ -600,10 +604,8 @@ isis_route_validate_merge (struct isis_area *area, int family)
 
   if (family == AF_INET)
     table = area->route_table[1];
-#ifdef HAVE_IPV6
   else if (family == AF_INET6)
     table = area->route_table6[1];
-#endif
 
   for (rnode = route_top (table); rnode; rnode = route_next (rnode))
     {
index ecbb63c92bd3e65be0de2fee2cfa22ca858f33ab..51919bb3f2ae07c9be2c7ba9b3ef73d2da081db3 100644 (file)
@@ -985,17 +985,15 @@ show_vty_unknown_tlv (struct vty *vty, struct subtlv_header *tlvh)
 void
 mpls_te_print_detail(struct vty *vty, struct te_is_neigh *te)
 {
-  struct subtlv_header *tlvh, *next;
+  struct subtlv_header *tlvh;
   u_int16_t sum = 0;
 
   zlog_debug ("ISIS MPLS-TE: Show database TE detail");
 
   tlvh = (struct subtlv_header *)te->sub_tlvs;
 
-  for (; sum < te->sub_tlvs_length; tlvh = (next ? next : SUBTLV_HDR_NEXT (tlvh)))
+  for (; sum < te->sub_tlvs_length; tlvh = SUBTLV_HDR_NEXT (tlvh))
     {
-      next = NULL;
-
       switch (tlvh->type)
       {
       case TE_SUBTLV_ADMIN_GRP:
@@ -1222,13 +1220,10 @@ DEFUN (show_isis_mpls_te_router,
     {
       vty_out (vty, "--- MPLS-TE router parameters ---%s", VTY_NEWLINE);
 
-      if (vty != NULL)
-        {
-          if (ntohs (isisMplsTE.router_id.s_addr) != 0)
-            vty_out (vty, "  Router-Address: %s%s", inet_ntoa (isisMplsTE.router_id), VTY_NEWLINE);
-          else
-            vty_out (vty, "  N/A%s", VTY_NEWLINE);
-        }
+      if (ntohs (isisMplsTE.router_id.s_addr) != 0)
+        vty_out (vty, "  Router-Address: %s%s", inet_ntoa (isisMplsTE.router_id), VTY_NEWLINE);
+      else
+        vty_out (vty, "  N/A%s", VTY_NEWLINE);
     }
   else
     vty_out (vty, "  MPLS-TE is disable on this router%s", VTY_NEWLINE);