Merge pull request #7555 from idryzhov/cppcheck-fixes

fix a couple of issues found by cppcheck
This commit is contained in:
Mark Stapp 2020-11-18 14:29:25 -05:00 committed by GitHub
commit 84c709bc6e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 9 additions and 9 deletions

View File

@ -229,9 +229,9 @@ int bgp_flowspec_ip_address(enum bgp_flowspec_util_nlri_t type,
case BGP_FLOWSPEC_CONVERT_TO_NON_OPAQUE: case BGP_FLOWSPEC_CONVERT_TO_NON_OPAQUE:
if (prefix) { if (prefix) {
if (prefix_local.family == AF_INET) if (prefix_local.family == AF_INET)
PREFIX_COPY_IPV4(prefix, &prefix_local) PREFIX_COPY_IPV4(prefix, &prefix_local);
else else
PREFIX_COPY_IPV6(prefix, &prefix_local) PREFIX_COPY_IPV6(prefix, &prefix_local);
} }
break; break;
case BGP_FLOWSPEC_VALIDATE_ONLY: case BGP_FLOWSPEC_VALIDATE_ONLY:

View File

@ -215,7 +215,7 @@ int isis_sock_init(struct isis_circuit *circuit)
int isis_recv_pdu_bcast(struct isis_circuit *circuit, uint8_t *ssnpa) int isis_recv_pdu_bcast(struct isis_circuit *circuit, uint8_t *ssnpa)
{ {
int bytesread = 0, bytestoread, offset, one = 1; int bytesread = 0, bytestoread = 0, offset, one = 1;
uint8_t *buff_ptr; uint8_t *buff_ptr;
struct bpf_hdr *bpf_hdr; struct bpf_hdr *bpf_hdr;

View File

@ -479,7 +479,7 @@ extern void apply_mask_ipv4(struct prefix_ipv4 *);
#define PREFIX_COPY(DST, SRC) \ #define PREFIX_COPY(DST, SRC) \
*((struct prefix *)(DST)) = *((const struct prefix *)(SRC)) *((struct prefix *)(DST)) = *((const struct prefix *)(SRC))
#define PREFIX_COPY_IPV4(DST, SRC) \ #define PREFIX_COPY_IPV4(DST, SRC) \
*((struct prefix_ipv4 *)(DST)) = *((const struct prefix_ipv4 *)(SRC)); *((struct prefix_ipv4 *)(DST)) = *((const struct prefix_ipv4 *)(SRC))
extern int prefix_ipv4_any(const struct prefix_ipv4 *); extern int prefix_ipv4_any(const struct prefix_ipv4 *);
extern void apply_classful_mask_ipv4(struct prefix_ipv4 *); extern void apply_classful_mask_ipv4(struct prefix_ipv4 *);
@ -499,7 +499,7 @@ extern int str2prefix_ipv6(const char *, struct prefix_ipv6 *);
extern void apply_mask_ipv6(struct prefix_ipv6 *); extern void apply_mask_ipv6(struct prefix_ipv6 *);
#define PREFIX_COPY_IPV6(DST, SRC) \ #define PREFIX_COPY_IPV6(DST, SRC) \
*((struct prefix_ipv6 *)(DST)) = *((const struct prefix_ipv6 *)(SRC)); *((struct prefix_ipv6 *)(DST)) = *((const struct prefix_ipv6 *)(SRC))
extern int ip6_masklen(struct in6_addr); extern int ip6_masklen(struct in6_addr);
extern void masklen2ip6(const int, struct in6_addr *); extern void masklen2ip6(const int, struct in6_addr *);

View File

@ -68,9 +68,9 @@ static void ospf6_lsdb_set_key(struct prefix_ipv6 *key, const void *value,
#ifdef DEBUG #ifdef DEBUG
static void _lsdb_count_assert(struct ospf6_lsdb *lsdb) static void _lsdb_count_assert(struct ospf6_lsdb *lsdb)
{ {
struct ospf6_lsa *debug; struct ospf6_lsa *debug, *debugnext;
unsigned int num = 0; unsigned int num = 0;
for (ALL_LSDB(lsdb, debug)) for (ALL_LSDB(lsdb, debug, debugnext))
num++; num++;
if (num == lsdb->count) if (num == lsdb->count)
@ -78,7 +78,7 @@ static void _lsdb_count_assert(struct ospf6_lsdb *lsdb)
zlog_debug("PANIC !! lsdb[%p]->count = %d, real = %d", lsdb, zlog_debug("PANIC !! lsdb[%p]->count = %d, real = %d", lsdb,
lsdb->count, num); lsdb->count, num);
for (ALL_LSDB(lsdb, debug)) for (ALL_LSDB(lsdb, debug, debugnext))
zlog_debug("%s lsdb[%p]", debug->name, debug->lsdb); zlog_debug("%s lsdb[%p]", debug->name, debug->lsdb);
zlog_debug("DUMP END"); zlog_debug("DUMP END");

View File

@ -152,7 +152,7 @@ struct rnh *zebra_add_rnh(struct prefix *p, vrf_id_t vrfid, enum rnh_type type,
flog_warn(EC_ZEBRA_RNH_NO_TABLE, flog_warn(EC_ZEBRA_RNH_NO_TABLE,
"%s(%u): Add RNH %pFX type %s - table not found", "%s(%u): Add RNH %pFX type %s - table not found",
VRF_LOGNAME(vrf), vrfid, p, rnh_type2str(type)); VRF_LOGNAME(vrf), vrfid, p, rnh_type2str(type));
exists = false; *exists = false;
return NULL; return NULL;
} }