summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndy Green <andy@warmcat.com>2018-05-14 13:00:57 +0800
committerFerruh Yigit <ferruh.yigit@intel.com>2018-05-14 23:32:23 +0200
commitd7a13d2d1c9d82bd7478d92157352911e4ef3c48 (patch)
tree20b2f41508346a7fc84f56ca2b7d3095fbfe3446
parent2e4d2e563f23930b06c24b7bc543bf04321d81f7 (diff)
downloaddpdk-d7a13d2d1c9d82bd7478d92157352911e4ef3c48.zip
dpdk-d7a13d2d1c9d82bd7478d92157352911e4ef3c48.tar.gz
dpdk-d7a13d2d1c9d82bd7478d92157352911e4ef3c48.tar.xz
net/vdev_netvsc: replace strncpy by strlcpy
Continue snprintf to strlcpy conversions started by commit c022cb400e92 ("convert snprintf to strlcpy"). Cc: stable@dpdk.org Signed-off-by: Andy Green <andy@warmcat.com> Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
-rw-r--r--drivers/net/vdev_netvsc/vdev_netvsc.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/net/vdev_netvsc/vdev_netvsc.c b/drivers/net/vdev_netvsc/vdev_netvsc.c
index ac26e0a..de2bd14 100644
--- a/drivers/net/vdev_netvsc/vdev_netvsc.c
+++ b/drivers/net/vdev_netvsc/vdev_netvsc.c
@@ -35,6 +35,7 @@
#include <rte_hypervisor.h>
#include <rte_kvargs.h>
#include <rte_log.h>
+#include <rte_string_fns.h>
#define VDEV_NETVSC_DRIVER net_vdev_netvsc
#define VDEV_NETVSC_DRIVER_NAME RTE_STR(VDEV_NETVSC_DRIVER)
@@ -182,7 +183,7 @@ vdev_netvsc_foreach_iface(int (*func)(const struct if_nameindex *iface,
is_netvsc_ret = vdev_netvsc_iface_is_netvsc(&iface[i]) ? 1 : 0;
if (is_netvsc ^ is_netvsc_ret)
continue;
- strncpy(req.ifr_name, iface[i].if_name, sizeof(req.ifr_name));
+ strlcpy(req.ifr_name, iface[i].if_name, sizeof(req.ifr_name));
if (ioctl(s, SIOCGIFHWADDR, &req) == -1) {
DRV_LOG(WARNING, "cannot retrieve information about"
" interface \"%s\": %s",
@@ -385,7 +386,7 @@ vdev_netvsc_device_probe(const struct if_nameindex *iface,
DRV_LOG(DEBUG,
"NetVSC interface \"%s\" (index %u) renamed \"%s\"",
ctx->if_name, ctx->if_index, iface->if_name);
- strncpy(ctx->if_name, iface->if_name, sizeof(ctx->if_name));
+ strlcpy(ctx->if_name, iface->if_name, sizeof(ctx->if_name));
return 0;
}
if (!is_same_ether_addr(eth_addr, &ctx->if_addr))
@@ -583,7 +584,7 @@ vdev_netvsc_netvsc_probe(const struct if_nameindex *iface,
goto error;
}
ctx->id = vdev_netvsc_ctx_count;
- strncpy(ctx->if_name, iface->if_name, sizeof(ctx->if_name));
+ strlcpy(ctx->if_name, iface->if_name, sizeof(ctx->if_name));
ctx->if_index = iface->if_index;
ctx->if_addr = *eth_addr;
ctx->pipe[0] = -1;