From f953dfc8e01426ce93588e9013c112e48a9a8463 Mon Sep 17 00:00:00 2001 From: Steven Date: Thu, 30 Nov 2017 16:56:54 -0800 Subject: virtio: fix coverity warnings Fix 3 coverity warnings 1. api_format.c: init net_ns = 0 and remove its corresponding vec_add and vec_free 2. netlink.c (reported in tap.c before the code was removed): resource leaked due to fd is not close 3. tap.c: subtract 1 for size when calling strncpy to accommodate the terminated NULL character Change-Id: Iff4e66604862f0c06dac227b8cfd48d3979e41a5 Signed-off-by: Steven --- src/vnet/devices/virtio/tap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/vnet/devices/virtio') diff --git a/src/vnet/devices/virtio/tap.c b/src/vnet/devices/virtio/tap.c index f6db2c90616..34339c95737 100644 --- a/src/vnet/devices/virtio/tap.c +++ b/src/vnet/devices/virtio/tap.c @@ -109,7 +109,7 @@ tap_create_if (vlib_main_t * vm, tap_create_if_args_t * args) } ifr.ifr_flags = IFF_TAP | IFF_NO_PI | IFF_ONE_QUEUE | IFF_VNET_HDR; - strncpy (ifr.ifr_ifrn.ifrn_name, (char *) args->name, IF_NAMESIZE); + strncpy (ifr.ifr_ifrn.ifrn_name, (char *) args->name, IF_NAMESIZE - 1); _IOCTL (vif->tap_fd, TUNSETIFF, (void *) &ifr); vif->ifindex = if_nametoindex ((char *) args->name); -- cgit 1.2.3-korg