From b9a3183d3a7fac7fffbc43d721208a31e355238c Mon Sep 17 00:00:00 2001 From: Aaron Conole Date: Fri, 15 Jun 2018 09:20:12 -0400 Subject: [PATCH] netdev-dpdk: Avoid warning for snprintf() call. lib/netdev-dpdk.c: In function : lib/netdev-dpdk.c:2865:49: warning: output may be truncated before the last format character [-Wformat-truncation=] snprintf(vhost_vring, 16, "vring_%d_size", i); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Suggested-by: Ben Pfaff Signed-off-by: Aaron Conole Signed-off-by: Ben Pfaff Acked-by: Ilya Maximets --- lib/netdev-dpdk.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c index a76e489a2..1bde9cfe7 100644 --- a/lib/netdev-dpdk.c +++ b/lib/netdev-dpdk.c @@ -2883,11 +2883,10 @@ netdev_dpdk_vhost_user_get_status(const struct netdev *netdev, for (int i = 0; i < vring_num; i++) { struct rte_vhost_vring vring; - char vhost_vring[16]; rte_vhost_get_vhost_vring(vid, i, &vring); - snprintf(vhost_vring, 16, "vring_%d_size", i); - smap_add_format(args, vhost_vring, "%d", vring.size); + smap_add_nocopy(args, xasprintf("vring_%d_size", i), + xasprintf("%d", vring.size)); } ovs_mutex_unlock(&dev->mutex); -- 2.39.5