bgpd: Clean up some static analysis warnings

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Reviewed-by: Don Slice <dslice@cumulusnetworks.com>
Reviewed-by: Daniel Walton <dwalton@cumulusnetworks.com>
This commit is contained in:
Donald Sharp 2016-05-06 20:19:05 -04:00
parent 9050881a77
commit 18f1dc06c5
7 changed files with 8 additions and 19 deletions

View File

@ -1045,20 +1045,15 @@ struct aspath *
aspath_aggregate (struct aspath *as1, struct aspath *as2)
{
int i;
int minlen;
int match;
int minlen = 0;
int match = 0;
int from;
struct assegment *seg1 = as1->segments;
struct assegment *seg2 = as2->segments;
struct aspath *aspath = NULL;
struct assegment *asset;
struct assegment *asset = NULL;
struct assegment *prevseg = NULL;
match = 0;
minlen = 0;
aspath = NULL;
asset = NULL;
/* First of all check common leading sequence. */
while (seg1 && seg2)
{

View File

@ -564,7 +564,7 @@ bgp_info_mpath_update (struct bgp_node *rn, struct bgp_info *new_best,
bgp_info_nexthop_cmp (prev_mpath, new_mpath))
{
if (new_mpath == next_mpath)
next_mpath = bgp_info_mpath_next (new_mpath);
bgp_info_mpath_next (new_mpath);
bgp_info_mpath_dequeue (new_mpath);
bgp_info_mpath_enqueue (prev_mpath, new_mpath);

View File

@ -993,13 +993,12 @@ end:
int
bgp_open_option_parse (struct peer *peer, u_char length, int *mp_capability)
{
int ret;
int ret = 0;
u_char *error;
u_char error_data[BGP_MAX_PACKET_SIZE];
struct stream *s = BGP_INPUT(peer);
size_t end = stream_get_getp (s) + length;
ret = 0;
error = error_data;
if (bgp_debug_neighbor_events(peer))

View File

@ -2348,7 +2348,7 @@ bgp_read (struct thread *thread)
goto done;
/* Get size and type again. */
size = stream_getw_from (peer->ibuf, BGP_MARKER_SIZE);
(void)stream_getw_from (peer->ibuf, BGP_MARKER_SIZE);
type = stream_getc_from (peer->ibuf, BGP_MARKER_SIZE + 2);
/* BGP packet dump function. */

View File

@ -1542,7 +1542,6 @@ bgp_best_selection (struct bgp *bgp, struct bgp_node *rn,
continue;
new_select = ri1;
old_select = CHECK_FLAG (ri1->flags, BGP_INFO_SELECTED) ? ri1 : NULL;
if (ri1->next)
{
for (ri2 = ri1->next; ri2; ri2 = ri2->next)
@ -1561,8 +1560,6 @@ bgp_best_selection (struct bgp *bgp, struct bgp_node *rn,
|| aspath_cmp_left_confed (ri1->attr->aspath,
ri2->attr->aspath))
{
if (CHECK_FLAG (ri2->flags, BGP_INFO_SELECTED))
old_select = ri2;
if (bgp_info_cmp (bgp, ri2, new_select, &paths_eq,
mpath_cfg, debug, pfx_buf))
{

View File

@ -1048,7 +1048,7 @@ subgroup_default_withdraw_packet (struct update_subgroup *subgrp)
unsigned long attrlen_pos = 0;
unsigned long cp;
bgp_size_t unfeasible_len;
bgp_size_t total_attr_len;
bgp_size_t total_attr_len = 0;
size_t mp_start = 0;
size_t mplen_pos = 0;
afi_t afi;
@ -1070,8 +1070,6 @@ subgroup_default_withdraw_packet (struct update_subgroup *subgrp)
str2prefix ("::/0", &p);
#endif /* HAVE_IPV6 */
total_attr_len = 0;
if (bgp_debug_update(NULL, &p, subgrp->update_group, 0))
{
char buf[INET6_BUFSIZ];

View File

@ -393,7 +393,7 @@ bgp_clear (struct vty *vty, struct bgp *bgp, afi_t afi, safi_t safi,
{
if (stype == BGP_CLEAR_SOFT_NONE)
{
ret = peer_clear (peer, NULL);
peer_clear (peer, NULL);
continue;
}