Merge pull request #3006 from pacovn/static_analysis__shadow_variables1

bgpd isisd ospf6d ospfd: variable shadowing fixes
This commit is contained in:
Donald Sharp 2018-09-13 08:37:22 -04:00 committed by GitHub
commit fc6eb7d827
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
17 changed files with 21 additions and 51 deletions

View File

@ -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;
}
/*

View File

@ -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;
}

View File

@ -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];

View File

@ -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(

View File

@ -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",

View File

@ -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;
}

View File

@ -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)

View File

@ -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(

View File

@ -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,

View File

@ -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;

View File

@ -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,

View File

@ -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))

View File

@ -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");

View File

@ -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)

View File

@ -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);

View File

@ -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];

View File

@ -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];