net/vdev_netvsc: readlink inputs cannot be aliased
authorAndy Green <andy@warmcat.com>
Mon, 14 May 2018 05:00:52 +0000 (13:00 +0800)
committerFerruh Yigit <ferruh.yigit@intel.com>
Mon, 14 May 2018 21:32:23 +0000 (23:32 +0200)
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 <andy@warmcat.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
drivers/net/vdev_netvsc/vdev_netvsc.c

index c321a9f..ac26e0a 100644 (file)
@@ -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)