summaryrefslogtreecommitdiffstats
path: root/src/vnet/devices/virtio
diff options
context:
space:
mode:
authorDave Barach <dave@barachs.net>2018-10-17 10:38:51 -0400
committerDamjan Marion <dmarion@me.com>2018-10-23 13:06:46 +0000
commitb7b929931a07fbb27b43d5cd105f366c3e29807e (patch)
tree438681c89738802dbb5d339715b96ea2c31bafb4 /src/vnet/devices/virtio
parentb9a4c445c1d4e9cdab476a8e1fb8a46ff0fc6080 (diff)
c11 safe string handling support
Change-Id: Ied34720ca5a6e6e717eea4e86003e854031b6eab Signed-off-by: Dave Barach <dave@barachs.net>
Diffstat (limited to 'src/vnet/devices/virtio')
-rw-r--r--src/vnet/devices/virtio/device.c2
-rw-r--r--src/vnet/devices/virtio/vhost_user.c8
-rw-r--r--src/vnet/devices/virtio/vhost_user_api.c4
-rw-r--r--src/vnet/devices/virtio/vhost_user_input.c2
-rw-r--r--src/vnet/devices/virtio/vhost_user_output.c2
-rw-r--r--src/vnet/devices/virtio/virtio.c6
6 files changed, 12 insertions, 12 deletions
diff --git a/src/vnet/devices/virtio/device.c b/src/vnet/devices/virtio/device.c
index c7efe6519cd..9b01b9183c8 100644
--- a/src/vnet/devices/virtio/device.c
+++ b/src/vnet/devices/virtio/device.c
@@ -132,7 +132,7 @@ add_buffer_to_slot (vlib_main_t * vm, virtio_vring_t * vring, u32 bi,
vlib_buffer_t *b = vlib_get_buffer (vm, bi);
struct virtio_net_hdr_v1 *hdr = vlib_buffer_get_current (b) - hdr_sz;
- memset (hdr, 0, hdr_sz);
+ clib_memset (hdr, 0, hdr_sz);
if (PREDICT_TRUE ((b->flags & VLIB_BUFFER_NEXT_PRESENT) == 0))
{
diff --git a/src/vnet/devices/virtio/vhost_user.c b/src/vnet/devices/virtio/vhost_user.c
index 1342030a651..9725a91027d 100644
--- a/src/vnet/devices/virtio/vhost_user.c
+++ b/src/vnet/devices/virtio/vhost_user.c
@@ -307,7 +307,7 @@ static_always_inline void
vhost_user_vring_init (vhost_user_intf_t * vui, u32 qid)
{
vhost_user_vring_t *vring = &vui->vrings[qid];
- memset (vring, 0, sizeof (*vring));
+ clib_memset (vring, 0, sizeof (*vring));
vring->kickfd_idx = ~0;
vring->callfd_idx = ~0;
vring->errfd = -1;
@@ -394,8 +394,8 @@ vhost_user_socket_read (clib_file_t * uf)
char control[CMSG_SPACE (VHOST_MEMORY_MAX_NREGIONS * sizeof (int))];
- memset (&mh, 0, sizeof (mh));
- memset (control, 0, sizeof (control));
+ clib_memset (&mh, 0, sizeof (mh));
+ clib_memset (control, 0, sizeof (control));
for (i = 0; i < VHOST_MEMORY_MAX_NREGIONS; i++)
fds[i] = -1;
@@ -1419,7 +1419,7 @@ vhost_user_vui_init (vnet_main_t * vnm,
{
vui->vring_locks[q] = clib_mem_alloc_aligned (CLIB_CACHE_LINE_BYTES,
CLIB_CACHE_LINE_BYTES);
- memset ((void *) vui->vring_locks[q], 0, CLIB_CACHE_LINE_BYTES);
+ clib_memset ((void *) vui->vring_locks[q], 0, CLIB_CACHE_LINE_BYTES);
}
vec_validate (vui->per_cpu_tx_qid,
diff --git a/src/vnet/devices/virtio/vhost_user_api.c b/src/vnet/devices/virtio/vhost_user_api.c
index 016ccbd2687..b8d89a07cbc 100644
--- a/src/vnet/devices/virtio/vhost_user_api.c
+++ b/src/vnet/devices/virtio/vhost_user_api.c
@@ -58,7 +58,7 @@ send_sw_interface_event_deleted (vpe_api_main_t * am,
vl_api_sw_interface_event_t *mp;
mp = vl_msg_api_alloc (sizeof (*mp));
- memset (mp, 0, sizeof (*mp));
+ clib_memset (mp, 0, sizeof (*mp));
mp->_vl_msg_id = ntohs (VL_API_SW_INTERFACE_EVENT);
mp->sw_if_index = ntohl (sw_if_index);
@@ -165,7 +165,7 @@ send_sw_interface_vhost_user_details (vpe_api_main_t * am,
vl_api_sw_interface_vhost_user_details_t *mp;
mp = vl_msg_api_alloc (sizeof (*mp));
- memset (mp, 0, sizeof (*mp));
+ clib_memset (mp, 0, sizeof (*mp));
mp->_vl_msg_id = ntohs (VL_API_SW_INTERFACE_VHOST_USER_DETAILS);
mp->sw_if_index = ntohl (vui->sw_if_index);
mp->virtio_net_hdr_sz = ntohl (vui->virtio_net_hdr_sz);
diff --git a/src/vnet/devices/virtio/vhost_user_input.c b/src/vnet/devices/virtio/vhost_user_input.c
index 26140484d2e..291d687ab6a 100644
--- a/src/vnet/devices/virtio/vhost_user_input.c
+++ b/src/vnet/devices/virtio/vhost_user_input.c
@@ -101,7 +101,7 @@ vhost_user_rx_trace (vhost_trace_t * t,
virtio_net_hdr_mrg_rxbuf_t *hdr;
u32 hint = 0;
- memset (t, 0, sizeof (*t));
+ clib_memset (t, 0, sizeof (*t));
t->device_index = vui - vum->vhost_user_interfaces;
t->qid = qid;
diff --git a/src/vnet/devices/virtio/vhost_user_output.c b/src/vnet/devices/virtio/vhost_user_output.c
index dab8fa5fb3b..820594999c8 100644
--- a/src/vnet/devices/virtio/vhost_user_output.c
+++ b/src/vnet/devices/virtio/vhost_user_output.c
@@ -155,7 +155,7 @@ vhost_user_tx_trace (vhost_trace_t * t,
vring_desc_t *hdr_desc = 0;
u32 hint = 0;
- memset (t, 0, sizeof (*t));
+ clib_memset (t, 0, sizeof (*t));
t->device_index = vui - vum->vhost_user_interfaces;
t->qid = qid;
diff --git a/src/vnet/devices/virtio/virtio.c b/src/vnet/devices/virtio/virtio.c
index 072e8a755b0..17de781921d 100644
--- a/src/vnet/devices/virtio/virtio.c
+++ b/src/vnet/devices/virtio/virtio.c
@@ -85,19 +85,19 @@ virtio_vring_init (vlib_main_t * vm, virtio_if_t * vif, u16 idx, u16 sz)
i = sizeof (struct vring_desc) * sz;
i = round_pow2 (i, CLIB_CACHE_LINE_BYTES);
vring->desc = clib_mem_alloc_aligned (i, CLIB_CACHE_LINE_BYTES);
- memset (vring->desc, 0, i);
+ clib_memset (vring->desc, 0, i);
i = sizeof (struct vring_avail) + sz * sizeof (vring->avail->ring[0]);
i = round_pow2 (i, CLIB_CACHE_LINE_BYTES);
vring->avail = clib_mem_alloc_aligned (i, CLIB_CACHE_LINE_BYTES);
- memset (vring->avail, 0, i);
+ clib_memset (vring->avail, 0, i);
// tell kernel that we don't need interrupt
vring->avail->flags = VIRTIO_RING_FLAG_MASK_INT;
i = sizeof (struct vring_used) + sz * sizeof (struct vring_used_elem);
i = round_pow2 (i, CLIB_CACHE_LINE_BYTES);
vring->used = clib_mem_alloc_aligned (i, CLIB_CACHE_LINE_BYTES);
- memset (vring->used, 0, i);
+ clib_memset (vring->used, 0, i);
ASSERT (vring->buffers == 0);
vec_validate_aligned (vring->buffers, sz, CLIB_CACHE_LINE_BYTES);