From b7b929931a07fbb27b43d5cd105f366c3e29807e Mon Sep 17 00:00:00 2001 From: Dave Barach Date: Wed, 17 Oct 2018 10:38:51 -0400 Subject: c11 safe string handling support Change-Id: Ied34720ca5a6e6e717eea4e86003e854031b6eab Signed-off-by: Dave Barach --- src/plugins/map/examples/health_check.c | 2 +- src/plugins/map/map.c | 16 ++++++++-------- src/plugins/map/map_api.c | 8 ++++---- 3 files changed, 13 insertions(+), 13 deletions(-) (limited to 'src/plugins/map') diff --git a/src/plugins/map/examples/health_check.c b/src/plugins/map/examples/health_check.c index 5f0d85fec08..f4e9a689b5b 100644 --- a/src/plugins/map/examples/health_check.c +++ b/src/plugins/map/examples/health_check.c @@ -55,7 +55,7 @@ main (int argc, char **argv) exit (EXIT_FAILURE); } - memset(&ifr, 0, sizeof(ifr)); + clib_memset(&ifr, 0, sizeof(ifr)); snprintf(ifr.ifr_name, sizeof(ifr.ifr_name), "%s", interface); /* Bind socket to interface of this node. */ diff --git a/src/plugins/map/map.c b/src/plugins/map/map.c index f2da818dd7b..13caa368322 100644 --- a/src/plugins/map/map.c +++ b/src/plugins/map/map.c @@ -130,7 +130,7 @@ map_create_domain (ip4_address_t * ip4_prefix, /* Get domain index */ pool_get_aligned (mm->domains, d, CLIB_CACHE_LINE_BYTES); - memset (d, 0, sizeof (*d)); + clib_memset (d, 0, sizeof (*d)); *map_domain_index = d - mm->domains; /* Init domain struct */ @@ -316,7 +316,7 @@ map_add_del_psid (u32 map_domain_index, u16 psid, ip6_address_t * tep, d->rules = clib_mem_alloc_aligned (l, CLIB_CACHE_LINE_BYTES); if (!d->rules) return -1; - memset (d->rules, 0, l); + clib_memset (d->rules, 0, l); } if (psid >= (0x1 << d->psid_length)) @@ -332,7 +332,7 @@ map_add_del_psid (u32 map_domain_index, u16 psid, ip6_address_t * tep, } else { - memset (&d->rules[psid], 0, sizeof (ip6_address_t)); + clib_memset (&d->rules[psid], 0, sizeof (ip6_address_t)); } return 0; } @@ -745,8 +745,8 @@ map_pre_resolve_command_fn (vlib_main_t * vm, clib_error_t *error = NULL; int is_del = 0; - memset (&ip4nh, 0, sizeof (ip4nh)); - memset (&ip6nh, 0, sizeof (ip6nh)); + clib_memset (&ip4nh, 0, sizeof (ip4nh)); + clib_memset (&ip6nh, 0, sizeof (ip6nh)); /* Get a line of input. */ if (!unformat_user (input, unformat_line_input, line_input)) @@ -974,7 +974,7 @@ format_map_domain (u8 * s, va_list * args) ip6_address_t ip6_prefix; if (d->rules) - memset (&ip6_prefix, 0, sizeof (ip6_prefix)); + clib_memset (&ip6_prefix, 0, sizeof (ip6_prefix)); else ip6_prefix = d->ip6_prefix; @@ -1210,8 +1210,8 @@ show_map_stats_command_fn (vlib_main_t * vm, unformat_input_t * input, int which, i; vlib_counter_t v; - memset (total_pkts, 0, sizeof (total_pkts)); - memset (total_bytes, 0, sizeof (total_bytes)); + clib_memset (total_pkts, 0, sizeof (total_pkts)); + clib_memset (total_bytes, 0, sizeof (total_bytes)); map_domain_counter_lock (mm); vec_foreach (cm, mm->domain_counters) diff --git a/src/plugins/map/map_api.c b/src/plugins/map/map_api.c index 90dbd1bcfd6..4b21c378379 100644 --- a/src/plugins/map/map_api.c +++ b/src/plugins/map/map_api.c @@ -120,7 +120,7 @@ vl_api_map_domain_dump_t_handler (vl_api_map_domain_dump_t * mp) /* *INDENT-OFF* */ pool_foreach(d, mm->domains, ({ - /* Make sure every field is initiated (or don't skip the memset()) */ + /* Make sure every field is initiated (or don't skip the clib_memset()) */ rmp = vl_msg_api_alloc (sizeof (*rmp)); rmp->_vl_msg_id = htons(VL_API_MAP_DOMAIN_DETAILS + mm->msg_id_base); rmp->context = mp->context; @@ -175,7 +175,7 @@ vl_api_map_rule_dump_t_handler (vl_api_map_rule_dump_t * mp) continue; } rmp = vl_msg_api_alloc (sizeof (*rmp)); - memset (rmp, 0, sizeof (*rmp)); + clib_memset (rmp, 0, sizeof (*rmp)); rmp->_vl_msg_id = ntohs (VL_API_MAP_RULE_DETAILS + mm->msg_id_base); rmp->psid = htons (i); clib_memcpy (rmp->ip6_dst, &dst, sizeof (rmp->ip6_dst)); @@ -211,8 +211,8 @@ vl_api_map_summary_stats_t_handler (vl_api_map_summary_stats_t * mp) goto out; } - memset (total_pkts, 0, sizeof (total_pkts)); - memset (total_bytes, 0, sizeof (total_bytes)); + clib_memset (total_pkts, 0, sizeof (total_pkts)); + clib_memset (total_bytes, 0, sizeof (total_bytes)); map_domain_counter_lock (mm); vec_foreach (cm, mm->domain_counters) -- cgit 1.2.3-korg