diff options
| author | Donald Sharp <sharpd@cumulusnetworks.com> | 2018-09-13 08:37:22 -0400 | 
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-09-13 08:37:22 -0400 | 
| commit | fc6eb7d827d7373a89dd04c1d809059e9ef79f9e (patch) | |
| tree | 407311c755f8251639660af2ecd05cb647085005 | |
| parent | 38ee5e636d116891b56327577de63ccb17d2bb05 (diff) | |
| parent | f7813c7c7fe3f6a12deb51de00bbf029b725f166 (diff) | |
Merge pull request #3006 from pacovn/static_analysis__shadow_variables1
bgpd isisd ospf6d ospfd: variable shadowing fixes
| -rw-r--r-- | bgpd/bgp_attr.c | 14 | ||||
| -rw-r--r-- | bgpd/bgp_route.c | 5 | ||||
| -rw-r--r-- | bgpd/bgp_routemap.c | 1 | ||||
| -rw-r--r-- | bgpd/bgpd.c | 1 | ||||
| -rw-r--r-- | bgpd/rfapi/rfapi.c | 2 | ||||
| -rw-r--r-- | bgpd/rfapi/rfapi_import.c | 6 | ||||
| -rw-r--r-- | bgpd/rfapi/rfapi_vty.c | 3 | ||||
| -rw-r--r-- | bgpd/rfapi/vnc_import_bgp.c | 10 | ||||
| -rw-r--r-- | isisd/isis_pdu.c | 3 | ||||
| -rw-r--r-- | isisd/isis_tlvs.c | 6 | ||||
| -rw-r--r-- | ospf6d/ospf6_abr.c | 3 | ||||
| -rw-r--r-- | ospfd/ospf_flood.c | 1 | ||||
| -rw-r--r-- | ospfd/ospf_ia.c | 8 | ||||
| -rw-r--r-- | ospfd/ospf_nsm.c | 2 | ||||
| -rw-r--r-- | ospfd/ospf_packet.c | 2 | ||||
| -rw-r--r-- | ospfd/ospf_zebra.c | 2 | ||||
| -rw-r--r-- | ospfd/ospfd.c | 3 | 
17 files changed, 21 insertions, 51 deletions
diff --git a/bgpd/bgp_attr.c b/bgpd/bgp_attr.c index 062a8a9b42..a603bbcd8b 100644 --- a/bgpd/bgp_attr.c +++ b/bgpd/bgp_attr.c @@ -2354,7 +2354,7 @@ bgp_attr_parse_ret_t bgp_attr_parse(struct peer *peer, struct attr *attr,  				    bgp_size_t size, struct bgp_nlri *mp_update,  				    struct bgp_nlri *mp_withdraw)  { -	int ret; +	bgp_attr_parse_ret_t ret;  	uint8_t flag = 0;  	uint8_t type = 0;  	bgp_size_t length; @@ -2509,7 +2509,6 @@ bgp_attr_parse_ret_t bgp_attr_parse(struct peer *peer, struct attr *attr,  		   Attribute Flags Error.  The Data field contains the erroneous  		   attribute (type, length and value). */  		if (bgp_attr_flag_invalid(&attr_args)) { -			bgp_attr_parse_ret_t ret;  			ret = bgp_attr_malformed(  				&attr_args, BGP_NOTIFY_UPDATE_ATTR_FLAG_ERR,  				attr_args.total); @@ -2647,13 +2646,10 @@ bgp_attr_parse_ret_t bgp_attr_parse(struct peer *peer, struct attr *attr,  	}  	/* Check all mandatory well-known attributes are present */ -	{ -		bgp_attr_parse_ret_t ret; -		if ((ret = bgp_attr_check(peer, attr)) < 0) { -			if (as4_path) -				aspath_unintern(&as4_path); -			return ret; -		} +	if ((ret = bgp_attr_check(peer, attr)) < 0) { +		if (as4_path) +			aspath_unintern(&as4_path); +		return ret;  	}  	/* diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index 2107d1f9f9..4c2df0dd0a 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -4040,7 +4040,6 @@ void bgp_clear_stale_route(struct peer *peer, afi_t afi, safi_t safi)  		for (rn = bgp_table_top(peer->bgp->rib[afi][safi]); rn;  		     rn = bgp_route_next(rn)) {  			struct bgp_node *rm; -			struct bgp_info *ri;  			/* look for neighbor in tables */  			if ((table = rn->info) == NULL) @@ -4728,7 +4727,6 @@ static void bgp_static_update_safi(struct bgp *bgp, struct prefix *p,  			break;  	if (ri) { -		union gw_addr add;  		memset(&add, 0, sizeof(union gw_addr));  		if (attrhash_cmp(ri->attr, attr_new)  		    && overlay_index_equal(afi, ri, bgp_static->eth_s_id, &add) @@ -8291,8 +8289,7 @@ static int bgp_show_table(struct vty *vty, struct bgp *bgp, safi_t safi,  					continue;  			}  			if (type == bgp_show_type_prefix_longer) { -				struct prefix *p = output_arg; - +				p = output_arg;  				if (!prefix_match(p, &rn->p))  					continue;  			} diff --git a/bgpd/bgp_routemap.c b/bgpd/bgp_routemap.c index bee4fca705..0b4355805c 100644 --- a/bgpd/bgp_routemap.c +++ b/bgpd/bgp_routemap.c @@ -3086,7 +3086,6 @@ static void bgp_route_map_process_update(struct bgp *bgp, const char *rmap_name,  	for (afi = AFI_IP; afi < AFI_MAX; afi++)  		for (i = 0; i < ZEBRA_ROUTE_MAX; i++) {  			struct list *red_list; -			struct listnode *node;  			struct bgp_redist *red;  			red_list = bgp->redist[afi][i]; diff --git a/bgpd/bgpd.c b/bgpd/bgpd.c index a9707a7fc7..066db1c774 100644 --- a/bgpd/bgpd.c +++ b/bgpd/bgpd.c @@ -7332,7 +7332,6 @@ static void bgp_config_write_family(struct vty *vty, struct bgp *bgp, afi_t afi,  		}  		if (CHECK_FLAG(bgp->af_flags[afi][safi],  			       BGP_CONFIG_VRF_TO_VRF_IMPORT)) { -			struct listnode *node;  			char *name;  			for (ALL_LIST_ELEMENTS_RO( diff --git a/bgpd/rfapi/rfapi.c b/bgpd/rfapi/rfapi.c index 51504bb0ad..18c3c63855 100644 --- a/bgpd/rfapi/rfapi.c +++ b/bgpd/rfapi/rfapi.c @@ -459,8 +459,6 @@ void del_vnc_route(struct rfapi_descriptor *rfd,  	rfapiProcessWithdraw(peer, rfd, p, prd, NULL, afi, safi, type, kill);  	if (bi) { -		char buf[PREFIX_STRLEN]; -  		prefix2str(p, buf, sizeof(buf));  		vnc_zlog_debug_verbose(  			"%s: Found route (safi=%d) to delete at prefix %s", diff --git a/bgpd/rfapi/rfapi_import.c b/bgpd/rfapi/rfapi_import.c index 4601718f12..f014f16fc2 100644 --- a/bgpd/rfapi/rfapi_import.c +++ b/bgpd/rfapi/rfapi_import.c @@ -3678,12 +3678,12 @@ void rfapiBgpInfoFilteredImportVPN(  		rfapiCopyUnEncap2VPN(ern->info, info_new);  		agg_unlock_node(ern); /* undo lock in route_note_match */  	} else { -		char buf[PREFIX_STRLEN]; +		char bpf[PREFIX_STRLEN]; -		prefix2str(&vn_prefix, buf, sizeof(buf)); +		prefix2str(&vn_prefix, bpf, sizeof(bpf));  		/* Not a big deal, just means VPN route got here first */  		vnc_zlog_debug_verbose("%s: no encap route for vn addr %s", -				       __func__, buf); +				       __func__, bpf);  		info_new->extra->vnc.import.un_family = 0;  	} diff --git a/bgpd/rfapi/rfapi_vty.c b/bgpd/rfapi/rfapi_vty.c index cd751319eb..9f8270097a 100644 --- a/bgpd/rfapi/rfapi_vty.c +++ b/bgpd/rfapi/rfapi_vty.c @@ -666,7 +666,6 @@ void rfapiPrintBi(void *stream, struct bgp_info *bi)  		   HVTYNL);  	}  	if (bi->extra && bi->extra->vnc.import.aux_prefix.family) { -		char buf[BUFSIZ];  		const char *sp;  		sp = rfapi_ntop(bi->extra->vnc.import.aux_prefix.family, @@ -3179,8 +3178,6 @@ static int rfapiDeleteLocalPrefixesByRFD(struct rfapi_local_reg_delete_arg *cda,  			list_delete_all_node(adb_delete_list);  			if (!(pPrefix && !RFAPI_0_PREFIX(pPrefix))) { -				void *cursor; -  				/*  				 * Caller didn't specify a prefix, or specified  				 * (0/32 or 0/128) diff --git a/bgpd/rfapi/vnc_import_bgp.c b/bgpd/rfapi/vnc_import_bgp.c index 6022e4cc24..dc37ff89b5 100644 --- a/bgpd/rfapi/vnc_import_bgp.c +++ b/bgpd/rfapi/vnc_import_bgp.c @@ -1010,13 +1010,13 @@ vnc_import_bgp_add_route_mode_nvegroup(struct bgp *bgp, struct prefix *prefix,  	bgp_attr_dup(&hattr, attr); /* hattr becomes a ghost attr */  	if (rmap) { -		struct bgp_info info; +		struct bgp_info binfo;  		route_map_result_t ret; -		memset(&info, 0, sizeof(info)); -		info.peer = peer; -		info.attr = &hattr; -		ret = route_map_apply(rmap, prefix, RMAP_BGP, &info); +		memset(&binfo, 0, sizeof(binfo)); +		binfo.peer = peer; +		binfo.attr = &hattr; +		ret = route_map_apply(rmap, prefix, RMAP_BGP, &binfo);  		if (ret == RMAP_DENYMATCH) {  			bgp_attr_flush(&hattr);  			vnc_zlog_debug_verbose( diff --git a/isisd/isis_pdu.c b/isisd/isis_pdu.c index 88575f5319..a335a96cdb 100644 --- a/isisd/isis_pdu.c +++ b/isisd/isis_pdu.c @@ -1311,8 +1311,7 @@ static int process_snp(uint8_t pdu_type, struct isis_circuit *circuit,  						continue;  					}  				} -				struct isis_lsp *lsp = -					lsp_new(circuit->area, entry->id, +				lsp = lsp_new(circuit->area, entry->id,  						entry->rem_lifetime, 0, 0,  						entry->checksum, lsp0, level);  				lsp_insert(lsp, diff --git a/isisd/isis_tlvs.c b/isisd/isis_tlvs.c index b22460a0b5..782462766a 100644 --- a/isisd/isis_tlvs.c +++ b/isisd/isis_tlvs.c @@ -1904,9 +1904,9 @@ static void format_item_auth(uint16_t mtid, struct isis_item *i,  		sbuf_push(buf, indent, "  Password: %s\n", obuf);  		break;  	case ISIS_PASSWD_TYPE_HMAC_MD5: -		for (unsigned int i = 0; i < 16; i++) { -			snprintf(obuf + 2 * i, sizeof(obuf) - 2 * i, -				 "%02" PRIx8, auth->value[i]); +		for (unsigned int j = 0; j < 16; j++) { +			snprintf(obuf + 2 * j, sizeof(obuf) - 2 * j, +				 "%02" PRIx8, auth->value[j]);  		}  		sbuf_push(buf, indent, "  HMAC-MD5: %s\n", obuf);  		break; diff --git a/ospf6d/ospf6_abr.c b/ospf6d/ospf6_abr.c index 7bccc78e00..586584c65c 100644 --- a/ospf6d/ospf6_abr.c +++ b/ospf6d/ospf6_abr.c @@ -918,9 +918,6 @@ void ospf6_abr_examin_summary(struct ospf6_lsa *lsa, struct ospf6_area *oa)  			 * old as the route.  			 */  			if (listcount(route->paths) > 1) { -				struct listnode *anode; -				struct ospf6_path *o_path; -  				for (ALL_LIST_ELEMENTS_RO(route->paths, anode,  							  o_path)) {  					inet_ntop(AF_INET, diff --git a/ospfd/ospf_flood.c b/ospfd/ospf_flood.c index b4e9dda58a..8078455930 100644 --- a/ospfd/ospf_flood.c +++ b/ospfd/ospf_flood.c @@ -539,7 +539,6 @@ static int ospf_flood_through_interface(struct ospf_interface *oi,  	    IP addresses for these packets are the neighbors' IP  	    addresses.   */  	if (oi->type == OSPF_IFTYPE_NBMA) { -		struct route_node *rn;  		struct ospf_neighbor *nbr;  		for (rn = route_top(oi->nbrs); rn; rn = route_next(rn)) diff --git a/ospfd/ospf_ia.c b/ospfd/ospf_ia.c index 86d15480a3..f1ba8a31e8 100644 --- a/ospfd/ospf_ia.c +++ b/ospfd/ospf_ia.c @@ -589,23 +589,19 @@ static void ospf_examine_transit_summaries(struct ospf_area *area,  void ospf_ia_routing(struct ospf *ospf, struct route_table *rt,  		     struct route_table *rtrs)  { +	struct listnode *node;  	struct ospf_area *area;  	if (IS_DEBUG_OSPF_EVENT)  		zlog_debug("ospf_ia_routing():start");  	if (IS_OSPF_ABR(ospf)) { -		struct listnode *node; -		struct ospf_area *area; -  		switch (ospf->abr_type) {  		case OSPF_ABR_STAND:  			if (IS_DEBUG_OSPF_EVENT)  				zlog_debug("ospf_ia_routing():Standard ABR");  			if ((area = ospf->backbone)) { -				struct listnode *node; -  				if (IS_DEBUG_OSPF_EVENT) {  					zlog_debug(  						"ospf_ia_routing():backbone area found"); @@ -694,8 +690,6 @@ void ospf_ia_routing(struct ospf *ospf, struct route_table *rt,  			break;  		}  	} else { -		struct listnode *node; -  		if (IS_DEBUG_OSPF_EVENT)  			zlog_debug(  				"ospf_ia_routing():not ABR, considering all areas"); diff --git a/ospfd/ospf_nsm.c b/ospfd/ospf_nsm.c index 985e2efc98..fc8b516afa 100644 --- a/ospfd/ospf_nsm.c +++ b/ospfd/ospf_nsm.c @@ -714,7 +714,7 @@ static void nsm_change_state(struct ospf_neighbor *nbr, int state)  		ospf_router_lsa_update_area(oi->area);  		if (oi->type == OSPF_IFTYPE_VIRTUALLINK) { -			struct ospf_area *vl_area = ospf_area_lookup_by_area_id( +			vl_area = ospf_area_lookup_by_area_id(  				oi->ospf, oi->vl_data->vl_area_id);  			if (vl_area) diff --git a/ospfd/ospf_packet.c b/ospfd/ospf_packet.c index 76359a539e..59340fbf17 100644 --- a/ospfd/ospf_packet.c +++ b/ospfd/ospf_packet.c @@ -4091,7 +4091,7 @@ void ospf_ls_upd_send(struct ospf_neighbor *nbr, struct list *update, int flag,  			     ospf_lsa_lock(lsa)); /* oi->ls_upd_queue */  	if (send_lsupd_now) {  		struct list *send_update_list; -		struct route_node *rn, *rnext; +		struct route_node *rnext;  		for (rn = route_top(oi->ls_upd_queue); rn; rn = rnext) {  			rnext = route_next(rn); diff --git a/ospfd/ospf_zebra.c b/ospfd/ospf_zebra.c index 5dfea4378b..912142b78f 100644 --- a/ospfd/ospf_zebra.c +++ b/ospfd/ospf_zebra.c @@ -1205,7 +1205,6 @@ static void ospf_filter_update(struct access_list *access)  		/* Update distribute-list, and apply filter. */  		for (type = 0; type <= ZEBRA_ROUTE_MAX; type++) {  			struct list *red_list; -			struct listnode *node;  			struct ospf_redist *red;  			red_list = ospf->redist[type]; @@ -1295,7 +1294,6 @@ void ospf_prefix_list_update(struct prefix_list *plist)  		 */  		for (type = 0; type <= ZEBRA_ROUTE_MAX; type++) {  			struct list *red_list; -			struct listnode *node;  			struct ospf_redist *red;  			red_list = ospf->redist[type]; diff --git a/ospfd/ospfd.c b/ospfd/ospfd.c index a8535fa9c3..b18c5a93a7 100644 --- a/ospfd/ospfd.c +++ b/ospfd/ospfd.c @@ -719,8 +719,6 @@ static void ospf_finish_final(struct ospf *ospf)  	ospf_lsdb_free(ospf->lsdb);  	for (rn = route_top(ospf->maxage_lsa); rn; rn = route_next(rn)) { -		struct ospf_lsa *lsa; -  		if ((lsa = rn->info) != NULL) {  			ospf_lsa_unlock(&lsa);  			rn->info = NULL; @@ -756,7 +754,6 @@ static void ospf_finish_final(struct ospf *ospf)  	for (i = ZEBRA_ROUTE_SYSTEM; i <= ZEBRA_ROUTE_MAX; i++) {  		struct list *ext_list; -		struct listnode *node;  		struct ospf_external *ext;  		ext_list = ospf->external[i];  | 
