From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.warmcat.com (mail.warmcat.com [163.172.24.82]) by dpdk.org (Postfix) with ESMTP id CD7837ED0 for ; Wed, 9 May 2018 03:32:00 +0200 (CEST) From: Andy Green To: dev@dpdk.org Date: Wed, 09 May 2018 09:31:56 +0800 Message-ID: <152582951611.6809.6625415049400391374.stgit@localhost.localdomain> In-Reply-To: <152582834896.6809.14521072557832633661.stgit@localhost.localdomain> References: <152582834896.6809.14521072557832633661.stgit@localhost.localdomain> User-Agent: StGit/unknown-version Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Subject: [dpdk-dev] [PATCH v2 13/18] drivers/net/vdev: readlink inputs cannot be aliased X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 May 2018 01:32:00 -0000 /home/agreen/projects/dpdk/drivers/net/vdev_netvsc/ vdev_netvsc.c:335:2:error: passing argument 2 to restrict- qualified parameter aliases with argument 1 [-Werror=restrict] ret = readlink(buf, buf, size); ^~~ Signed-off-by: Andy Green --- drivers/net/vdev_netvsc/vdev_netvsc.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/net/vdev_netvsc/vdev_netvsc.c b/drivers/net/vdev_netvsc/vdev_netvsc.c index c321a9f1b..e0d3c1c7c 100644 --- a/drivers/net/vdev_netvsc/vdev_netvsc.c +++ b/drivers/net/vdev_netvsc/vdev_netvsc.c @@ -327,12 +327,14 @@ static int vdev_netvsc_sysfs_readlink(char *buf, size_t size, const char *if_name, const char *relpath) { + char in[160]; 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(buf) - 1, "/sys/class/net/%s/%s", + if_name, relpath); + if (ret == -1 || (size_t)ret >= sizeof(buf) - 1) return -ENOBUFS; - ret = readlink(buf, buf, size); + ret = readlink(in, buf, size); if (ret == -1) return -errno; if ((size_t)ret >= size - 1)