[dev] New Defects reported by Coverity Scan for freerangerouting/frr

scan-admin at coverity.com scan-admin at coverity.com
Tue May 28 15:24:21 EDT 2019


Hi,

Please find the latest report on new defect(s) introduced to freerangerouting/frr found with Coverity Scan.

23 new defect(s) introduced to freerangerouting/frr found with Coverity Scan.
14 defect(s), reported by Coverity Scan earlier, were marked fixed in the recent build analyzed by Coverity Scan.

New defect(s) Reported-by: Coverity Scan
Showing 20 of 23 defect(s)


** CID 1479151:  Null pointer dereferences  (NULL_RETURNS)
/pbrd/pbr_zebra.c: 113 in interface_address_add()


________________________________________________________________________________________________________
*** CID 1479151:  Null pointer dereferences  (NULL_RETURNS)
/pbrd/pbr_zebra.c: 113 in interface_address_add()
107     {
108     	struct connected *c;
109     	char buf[PREFIX_STRLEN];
110     
111     	c = zebra_interface_address_read(command, zclient->ibuf, vrf_id);
112     
>>>     CID 1479151:  Null pointer dereferences  (NULL_RETURNS)
>>>     Dereferencing a null pointer "c".
113     	DEBUGD(&pbr_dbg_zebra,
114     	       "%s: %s added %s", __PRETTY_FUNCTION__, c->ifp->name,
115     	       prefix2str(c->address, buf, sizeof(buf)));
116     
117     	return 0;
118     }

** CID 1479149:  Control flow issues  (DEADCODE)
/zebra/zebra_rib.c: 481 in nexthop_active()


________________________________________________________________________________________________________
*** CID 1479149:  Control flow issues  (DEADCODE)
/zebra/zebra_rib.c: 481 in nexthop_active()
475     						__PRETTY_FUNCTION__, ifp->name);
476     				return 0;
477     			}
478     		}
479     		if (!if_is_operative(ifp)) {
480     			if (IS_ZEBRA_DEBUG_RIB_DETAILED)
>>>     CID 1479149:  Control flow issues  (DEADCODE)
>>>     Execution cannot reach the expression ""Unknown"" inside this statement: "zlog_debug("\t%s: Interface...".
481     				zlog_debug(
482     					"\t%s: Interface %s is not unnumbered",
483     					__PRETTY_FUNCTION__,
484     					ifp ? ifp->name : "Unknown");
485     			return 0;
486     		}

** CID 1479148:  Incorrect expression  (COPY_PASTE_ERROR)
/zebra/zebra_rib.c: 1935 in rib_process_result()


________________________________________________________________________________________________________
*** CID 1479148:  Incorrect expression  (COPY_PASTE_ERROR)
/zebra/zebra_rib.c: 1935 in rib_process_result()
1929     		if (old_re->dplane_sequence != dplane_ctx_get_old_seq(ctx)) {
1930     			if (IS_ZEBRA_DEBUG_DPLANE_DETAIL)
1931     				zlog_debug("%u:%s Stale dplane result for old_re %p",
1932     					   dplane_ctx_get_vrf(ctx),
1933     					   dest_str, old_re);
1934     		} else
>>>     CID 1479148:  Incorrect expression  (COPY_PASTE_ERROR)
>>>     "re" in "re->status" looks like a copy-paste error.
1935     			UNSET_FLAG(re->status, ROUTE_ENTRY_QUEUED);
1936     	}
1937     
1938     	switch (op) {
1939     	case DPLANE_OP_ROUTE_INSTALL:
1940     	case DPLANE_OP_ROUTE_UPDATE:

** CID 1479146:  Null pointer dereferences  (FORWARD_NULL)
/zebra/zebra_rib.c: 1935 in rib_process_result()


________________________________________________________________________________________________________
*** CID 1479146:  Null pointer dereferences  (FORWARD_NULL)
/zebra/zebra_rib.c: 1935 in rib_process_result()
1929     		if (old_re->dplane_sequence != dplane_ctx_get_old_seq(ctx)) {
1930     			if (IS_ZEBRA_DEBUG_DPLANE_DETAIL)
1931     				zlog_debug("%u:%s Stale dplane result for old_re %p",
1932     					   dplane_ctx_get_vrf(ctx),
1933     					   dest_str, old_re);
1934     		} else
>>>     CID 1479146:  Null pointer dereferences  (FORWARD_NULL)
>>>     Dereferencing null pointer "re".
1935     			UNSET_FLAG(re->status, ROUTE_ENTRY_QUEUED);
1936     	}
1937     
1938     	switch (op) {
1939     	case DPLANE_OP_ROUTE_INSTALL:
1940     	case DPLANE_OP_ROUTE_UPDATE:

** CID 1479144:  Control flow issues  (DEADCODE)
/bgpd/bgp_mplsvpn.c: 323 in vpn_leak_zebra_vrf_label_withdraw()


________________________________________________________________________________________________________
*** CID 1479144:  Control flow issues  (DEADCODE)
/bgpd/bgp_mplsvpn.c: 323 in vpn_leak_zebra_vrf_label_withdraw()
317     	if (debug) {
318     		zlog_debug("%s: deleting label for vrf %s (id=%d)", __func__,
319     			   bgp->name_pretty, bgp->vrf_id);
320     	}
321     
322     	if (label == BGP_PREVENT_VRF_2_VRF_LEAK)
>>>     CID 1479144:  Control flow issues  (DEADCODE)
>>>     Execution cannot reach this statement: "label = 4294967295U;".
323     		label = MPLS_LABEL_NONE;
324     
325     	zclient_send_vrf_label(zclient, bgp->vrf_id, afi, label, ZEBRA_LSP_BGP);
326     	bgp->vpn_policy[afi].tovpn_zebra_vrf_label_last_sent = label;
327     }
328     

** CID 1479141:  Control flow issues  (DEADCODE)
/bgpd/bgp_evpn_vty.c: 3224 in bgp_evpn_advertise_svi_ip_vni_magic()


________________________________________________________________________________________________________
*** CID 1479141:  Control flow issues  (DEADCODE)
/bgpd/bgp_evpn_vty.c: 3224 in bgp_evpn_advertise_svi_ip_vni_magic()
3218     	VTY_DECLVAR_CONTEXT_SUB(bgpevpn, vpn);
3219     
3220     	if (!bgp)
3221     		return CMD_WARNING;
3222     
3223     	if (!vpn)
>>>     CID 1479141:  Control flow issues  (DEADCODE)
>>>     Execution cannot reach this statement: "return 1;".
3224     		return CMD_WARNING;
3225     
3226     	if (no)
3227     		evpn_set_advertise_svi_macip(bgp, vpn, 0);
3228     	else
3229     		evpn_set_advertise_svi_macip(bgp, vpn, 1);

** CID 1479139:  Control flow issues  (UNREACHABLE)
/ospfd/ospf_packet.c: 2110 in ospf_ls_upd()


________________________________________________________________________________________________________
*** CID 1479139:  Control flow issues  (UNREACHABLE)
/ospfd/ospf_packet.c: 2110 in ospf_ls_upd()
2104     					&& !IS_LSA_MAXAGE(lsa))) {
2105     				zlog_debug(
2106     					"Link State Update[%s]: has Max Seq but not MaxAge. Dropping it",
2107     					dump_lsa_key(lsa));
2108     
2109     				DISCARD_LSA(lsa, 4);
>>>     CID 1479139:  Control flow issues  (UNREACHABLE)
>>>     This code cannot be reached: "continue;".
2110     				continue;
2111     			}
2112     
2113     			/* Actual flooding procedure. */
2114     			if (ospf_flood(oi->ospf, nbr, current, lsa)
2115     			    < 0) /* Trap NSSA later. */

** CID 1475945:  Possible Control flow issues  (DEADCODE)
/lib/vrf.c: 910 in vrf_set_default_name()


________________________________________________________________________________________________________
*** CID 1475945:  Possible Control flow issues  (DEADCODE)
/lib/vrf.c: 910 in vrf_set_default_name()
904     	if (def_vrf && !force && def_vrf_forced) {
905     		zlog_debug("VRF: %s, avoid changing name to %s, previously forced (%u)",
906     			   def_vrf->name, default_name,
907     			   def_vrf->vrf_id);
908     		return;
909     	}
>>>     CID 1475945:  Possible Control flow issues  (DEADCODE)
>>>     Execution cannot reach the expression "vrf_with_default_name != def_vrf" inside this statement: "if (vrf_with_default_name &...".
910     	if (vrf_with_default_name && vrf_with_default_name != def_vrf) {
911     		/* vrf name already used by an other VRF */
912     		zlog_debug("VRF: %s, avoid changing name to %s, same name exists (%u)",
913     			   vrf_with_default_name->name, default_name,
914     			   vrf_with_default_name->vrf_id);
915     		return;

** CID 1474183:  Null pointer dereferences  (FORWARD_NULL)


________________________________________________________________________________________________________
*** CID 1474183:  Null pointer dereferences  (FORWARD_NULL)
/zebra/zebra_routemap_clippy.c: 190 in ipv6_protocol()
184     	}
185     #if 0 /* anything that can fail? */
186     	if (_failcnt)
187     		return CMD_WARNING;
188     #endif
189     #endif
>>>     CID 1474183:  Null pointer dereferences  (FORWARD_NULL)
>>>     Passing null pointer "rmap" to "ipv6_protocol_magic", which dereferences it.
190     	return ipv6_protocol_magic(self, vty, argc, argv, proto, rmap);
191     }
192     
193     /* no_ipv6_protocol => "no ipv6 protocol RR_IP6_PROTOCOL_MAP_STR_ZEBR $proto [route-map ROUTE-MAP$rmap]" */
194     DEFUN_CMD_FUNC_DECL(no_ipv6_protocol)
195     #define funcdecl_no_ipv6_protocol static int no_ipv6_protocol_magic(\

** CID 1474182:  Null pointer dereferences  (FORWARD_NULL)


________________________________________________________________________________________________________
*** CID 1474182:  Null pointer dereferences  (FORWARD_NULL)
/zebra/zebra_routemap_clippy.c: 478 in ipv6_protocol_nht_rmap()
472     	}
473     #if 0 /* anything that can fail? */
474     	if (_failcnt)
475     		return CMD_WARNING;
476     #endif
477     #endif
>>>     CID 1474182:  Null pointer dereferences  (FORWARD_NULL)
>>>     Passing null pointer "rmap" to "ipv6_protocol_nht_rmap_magic", which dereferences it.
478     	return ipv6_protocol_nht_rmap_magic(self, vty, argc, argv, proto, rmap);
479     }
480     
481     /* no_ipv6_protocol_nht_rmap => "no ipv6 nht RR_IP6_PROTOCOL_MAP_STR_ZEBR $proto [route-map ROUTE-MAP$rmap]" */
482     DEFUN_CMD_FUNC_DECL(no_ipv6_protocol_nht_rmap)
483     #define funcdecl_no_ipv6_protocol_nht_rmap static int no_ipv6_protocol_nht_rmap_magic(\

** CID 1474181:  Null pointer dereferences  (FORWARD_NULL)


________________________________________________________________________________________________________
*** CID 1474181:  Null pointer dereferences  (FORWARD_NULL)
/zebra/zebra_routemap_clippy.c: 334 in ip_protocol_nht_rmap()
328     	}
329     #if 0 /* anything that can fail? */
330     	if (_failcnt)
331     		return CMD_WARNING;
332     #endif
333     #endif
>>>     CID 1474181:  Null pointer dereferences  (FORWARD_NULL)
>>>     Passing null pointer "proto" to "ip_protocol_nht_rmap_magic", which dereferences it.
334     	return ip_protocol_nht_rmap_magic(self, vty, argc, argv, proto, rmap);
335     }
336     
337     /* no_ip_protocol_nht_rmap => "no ip nht RR_IP_PROTOCOL_MAP_STR_ZEBR $proto route-map [ROUTE-MAP$rmap]" */
338     DEFUN_CMD_FUNC_DECL(no_ip_protocol_nht_rmap)
339     #define funcdecl_no_ip_protocol_nht_rmap static int no_ip_protocol_nht_rmap_magic(\

** CID 1474180:  Null pointer dereferences  (FORWARD_NULL)


________________________________________________________________________________________________________
*** CID 1474180:  Null pointer dereferences  (FORWARD_NULL)
/zebra/zebra_routemap_clippy.c: 46 in ip_protocol()
40     	}
41     #if 0 /* anything that can fail? */
42     	if (_failcnt)
43     		return CMD_WARNING;
44     #endif
45     #endif
>>>     CID 1474180:  Null pointer dereferences  (FORWARD_NULL)
>>>     Passing null pointer "rmap" to "ip_protocol_magic", which dereferences it.
46     	return ip_protocol_magic(self, vty, argc, argv, proto, rmap);
47     }
48     
49     /* no_ip_protocol => "no ip protocol RR_IP_PROTOCOL_MAP_STR_ZEBR $proto [route-map ROUTE-MAP$rmap]" */
50     DEFUN_CMD_FUNC_DECL(no_ip_protocol)
51     #define funcdecl_no_ip_protocol static int no_ip_protocol_magic(\

** CID 1474179:  Null pointer dereferences  (FORWARD_NULL)


________________________________________________________________________________________________________
*** CID 1474179:  Null pointer dereferences  (FORWARD_NULL)
/zebra/zebra_routemap_clippy.c: 94 in no_ip_protocol()
88     	}
89     #if 0 /* anything that can fail? */
90     	if (_failcnt)
91     		return CMD_WARNING;
92     #endif
93     #endif
>>>     CID 1474179:  Null pointer dereferences  (FORWARD_NULL)
>>>     Passing null pointer "proto" to "no_ip_protocol_magic", which dereferences it.
94     	return no_ip_protocol_magic(self, vty, argc, argv, proto, rmap);
95     }
96     
97     /* show_ip_protocol => "show ip protocol [vrf <NAME$vrf_name|all$vrf_all>]" */
98     DEFUN_CMD_FUNC_DECL(show_ip_protocol)
99     #define funcdecl_show_ip_protocol static int show_ip_protocol_magic(\

** CID 1474178:  Null pointer dereferences  (FORWARD_NULL)


________________________________________________________________________________________________________
*** CID 1474178:  Null pointer dereferences  (FORWARD_NULL)
/zebra/zebra_routemap_clippy.c: 334 in ip_protocol_nht_rmap()
328     	}
329     #if 0 /* anything that can fail? */
330     	if (_failcnt)
331     		return CMD_WARNING;
332     #endif
333     #endif
>>>     CID 1474178:  Null pointer dereferences  (FORWARD_NULL)
>>>     Passing null pointer "rmap" to "ip_protocol_nht_rmap_magic", which dereferences it.
334     	return ip_protocol_nht_rmap_magic(self, vty, argc, argv, proto, rmap);
335     }
336     
337     /* no_ip_protocol_nht_rmap => "no ip nht RR_IP_PROTOCOL_MAP_STR_ZEBR $proto route-map [ROUTE-MAP$rmap]" */
338     DEFUN_CMD_FUNC_DECL(no_ip_protocol_nht_rmap)
339     #define funcdecl_no_ip_protocol_nht_rmap static int no_ip_protocol_nht_rmap_magic(\

** CID 1474177:  Null pointer dereferences  (FORWARD_NULL)


________________________________________________________________________________________________________
*** CID 1474177:  Null pointer dereferences  (FORWARD_NULL)
/zebra/zebra_routemap_clippy.c: 46 in ip_protocol()
40     	}
41     #if 0 /* anything that can fail? */
42     	if (_failcnt)
43     		return CMD_WARNING;
44     #endif
45     #endif
>>>     CID 1474177:  Null pointer dereferences  (FORWARD_NULL)
>>>     Passing null pointer "proto" to "ip_protocol_magic", which dereferences it.
46     	return ip_protocol_magic(self, vty, argc, argv, proto, rmap);
47     }
48     
49     /* no_ip_protocol => "no ip protocol RR_IP_PROTOCOL_MAP_STR_ZEBR $proto [route-map ROUTE-MAP$rmap]" */
50     DEFUN_CMD_FUNC_DECL(no_ip_protocol)
51     #define funcdecl_no_ip_protocol static int no_ip_protocol_magic(\

** CID 1474176:  Null pointer dereferences  (FORWARD_NULL)


________________________________________________________________________________________________________
*** CID 1474176:  Null pointer dereferences  (FORWARD_NULL)
/zebra/zebra_routemap_clippy.c: 526 in no_ipv6_protocol_nht_rmap()
520     	}
521     #if 0 /* anything that can fail? */
522     	if (_failcnt)
523     		return CMD_WARNING;
524     #endif
525     #endif
>>>     CID 1474176:  Null pointer dereferences  (FORWARD_NULL)
>>>     Passing null pointer "proto" to "no_ipv6_protocol_nht_rmap_magic", which dereferences it.
526     	return no_ipv6_protocol_nht_rmap_magic(self, vty, argc, argv, proto, rmap);
527     }
528     
529     /* show_ipv6_protocol_nht => "show ipv6 nht route-map [vrf <NAME$vrf_name|all$vrf_all>]" */
530     DEFUN_CMD_FUNC_DECL(show_ipv6_protocol_nht)
531     #define funcdecl_show_ipv6_protocol_nht static int show_ipv6_protocol_nht_magic(\

** CID 1474175:  Null pointer dereferences  (FORWARD_NULL)


________________________________________________________________________________________________________
*** CID 1474175:  Null pointer dereferences  (FORWARD_NULL)
/zebra/zebra_routemap_clippy.c: 478 in ipv6_protocol_nht_rmap()
472     	}
473     #if 0 /* anything that can fail? */
474     	if (_failcnt)
475     		return CMD_WARNING;
476     #endif
477     #endif
>>>     CID 1474175:  Null pointer dereferences  (FORWARD_NULL)
>>>     Passing null pointer "proto" to "ipv6_protocol_nht_rmap_magic", which dereferences it.
478     	return ipv6_protocol_nht_rmap_magic(self, vty, argc, argv, proto, rmap);
479     }
480     
481     /* no_ipv6_protocol_nht_rmap => "no ipv6 nht RR_IP6_PROTOCOL_MAP_STR_ZEBR $proto [route-map ROUTE-MAP$rmap]" */
482     DEFUN_CMD_FUNC_DECL(no_ipv6_protocol_nht_rmap)
483     #define funcdecl_no_ipv6_protocol_nht_rmap static int no_ipv6_protocol_nht_rmap_magic(\

** CID 1474174:  Null pointer dereferences  (FORWARD_NULL)


________________________________________________________________________________________________________
*** CID 1474174:  Null pointer dereferences  (FORWARD_NULL)
/zebra/zebra_routemap_clippy.c: 238 in no_ipv6_protocol()
232     	}
233     #if 0 /* anything that can fail? */
234     	if (_failcnt)
235     		return CMD_WARNING;
236     #endif
237     #endif
>>>     CID 1474174:  Null pointer dereferences  (FORWARD_NULL)
>>>     Passing null pointer "proto" to "no_ipv6_protocol_magic", which dereferences it.
238     	return no_ipv6_protocol_magic(self, vty, argc, argv, proto, rmap);
239     }
240     
241     /* show_ipv6_protocol => "show ipv6 protocol [vrf <NAME$vrf_name|all$vrf_all>]" */
242     DEFUN_CMD_FUNC_DECL(show_ipv6_protocol)
243     #define funcdecl_show_ipv6_protocol static int show_ipv6_protocol_magic(\

** CID 1474173:  Null pointer dereferences  (FORWARD_NULL)


________________________________________________________________________________________________________
*** CID 1474173:  Null pointer dereferences  (FORWARD_NULL)
/zebra/zebra_routemap_clippy.c: 382 in no_ip_protocol_nht_rmap()
376     	}
377     #if 0 /* anything that can fail? */
378     	if (_failcnt)
379     		return CMD_WARNING;
380     #endif
381     #endif
>>>     CID 1474173:  Null pointer dereferences  (FORWARD_NULL)
>>>     Passing null pointer "proto" to "no_ip_protocol_nht_rmap_magic", which dereferences it.
382     	return no_ip_protocol_nht_rmap_magic(self, vty, argc, argv, proto, rmap);
383     }
384     
385     /* show_ip_protocol_nht => "show ip nht route-map [vrf <NAME$vrf_name|all$vrf_all>]" */
386     DEFUN_CMD_FUNC_DECL(show_ip_protocol_nht)
387     #define funcdecl_show_ip_protocol_nht static int show_ip_protocol_nht_magic(\

** CID 1474172:  Null pointer dereferences  (FORWARD_NULL)


________________________________________________________________________________________________________
*** CID 1474172:  Null pointer dereferences  (FORWARD_NULL)
/zebra/zebra_routemap_clippy.c: 190 in ipv6_protocol()
184     	}
185     #if 0 /* anything that can fail? */
186     	if (_failcnt)
187     		return CMD_WARNING;
188     #endif
189     #endif
>>>     CID 1474172:  Null pointer dereferences  (FORWARD_NULL)
>>>     Passing null pointer "proto" to "ipv6_protocol_magic", which dereferences it.
190     	return ipv6_protocol_magic(self, vty, argc, argv, proto, rmap);
191     }
192     
193     /* no_ipv6_protocol => "no ipv6 protocol RR_IP6_PROTOCOL_MAP_STR_ZEBR $proto [route-map ROUTE-MAP$rmap]" */
194     DEFUN_CMD_FUNC_DECL(no_ipv6_protocol)
195     #define funcdecl_no_ipv6_protocol static int no_ipv6_protocol_magic(\


________________________________________________________________________________________________________
To view the defects in Coverity Scan visit, https://u2389337.ct.sendgrid.net/wf/click?upn=08onrYu34A-2BWcWUl-2F-2BfV0V05UPxvVjWch-2Bd2MGckcRa7dJ8klHLUFWVd2fqpS-2B-2FHaN43B-2FQ11ntcKmbKat2WeDU1AdI-2FBBrnda9ub5tlg3U-3D_d-2Fi2nRutHp-2FDWtw8JRg-2Bc1m9CS4-2B5uVbodfDyLsp-2FJmPw45TGXJo0GynwbkW7d9-2FWJZWDM7uMevzTsSt8dacPjhdGAowP8DftZ1xMGblgLNJqGst3MgjnH00RH9wZqr0JCTKvdMtPiaozx8Hd77BL99G4MUaVtBkqExdy-2FTQGkXpoqDGqISn3NQHtMOxXMeHtLE-2BmKT1rdWxjsG8-2BGDvJA-3D-3D




More information about the dev mailing list