From 2e4d2e563f23930b06c24b7bc543bf04321d81f7 Mon Sep 17 00:00:00 2001 From: Andy Green Date: Mon, 14 May 2018 13:00:52 +0800 Subject: [PATCH] net/vdev_netvsc: readlink inputs cannot be aliased drivers/net/vdev_netvsc/vdev_netvsc.c:335:2:error: passing argument 2 to restrict-qualified parameter aliases with argument 1 ret = readlink(buf, buf, size); ^~~ Fixes: e7dc5d7becc5 ("net/vdev_netvsc: implement core functionality") Cc: stable@dpdk.org Signed-off-by: Andy Green Acked-by: Pablo de Lara --- drivers/net/vdev_netvsc/vdev_netvsc.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/net/vdev_netvsc/vdev_netvsc.c b/drivers/net/vdev_netvsc/vdev_netvsc.c index c321a9f1b1..ac26e0a3ea 100644 --- a/drivers/net/vdev_netvsc/vdev_netvsc.c +++ b/drivers/net/vdev_netvsc/vdev_netvsc.c @@ -327,12 +327,15 @@ static int vdev_netvsc_sysfs_readlink(char *buf, size_t size, const char *if_name, const char *relpath) { + struct vdev_netvsc_ctx *ctx; + char in[RTE_MAX(sizeof(ctx->yield), 256u)]; int ret; - ret = snprintf(buf, size, "/sys/class/net/%s/%s", if_name, relpath); - if (ret == -1 || (size_t)ret >= size) + ret = snprintf(in, sizeof(in) - 1, "/sys/class/net/%s/%s", + if_name, relpath); + if (ret == -1 || (size_t)ret >= sizeof(in)) return -ENOBUFS; - ret = readlink(buf, buf, size); + ret = readlink(in, buf, size); if (ret == -1) return -errno; if ((size_t)ret >= size - 1) -- 2.20.1