[dpdk-dev] [PATCH v5 12/16] net/vdev_netvsc: readlink inputs cannot be aliased

Matan Azrad matan at mellanox.com
Sun May 13 09:20:28 CEST 2018


Hi Andy

From: Andy Green
> /home/agreen/projects/dpdk/drivers/net/vdev_netvsc/

Please replace "/home/agreen/projects/dpdk" in $DPDK_DIR,
I think this is relevant for all the series.

> vdev_netvsc.c:335:2:error: passing argument 2 to restrict- qualified parameter
> aliases with argument 1 [-Werror=restrict]
>   ret = readlink(buf, buf, size);
>   ^~~

Where this compilation error does come from?
What is the ARCH\gcc version? Why was it compiled well and now it not?
And the title should be something like, fix compilation issue in [distro X][arch Y] [gcc Z] [any other compilation specifications]
Please specify only the specification which causes the error.
I think this is relevant for all the series too.

> Signed-off-by: Andy Green <andy at warmcat.com>
> Fixes: e7dc5d7becc5 ("net/vdev_netvsc: implement core functionality")
What's about backporting it to stable?

The fixes line (and Cc lines) should be before the Signed-off-by line and an empty line should be between them,
I think this is relevant for all the series too.
 
> Acked-by: Pablo de Lara <pablo.de.lara.guarch at intel.com>
> ---
>  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..dca25761d 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];

Where the number 160 is come from?
Why not RTE_MAX(sizeof(ctx->yield), 256u) as defined for buf?

>  	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) - 1)

I don’t think you need the " - 1" here.
 
>  		return -ENOBUFS;
> -	ret = readlink(buf, buf, size);
> +	ret = readlink(in, buf, size);
>  	if (ret == -1)
>  		return -errno;
>  	if ((size_t)ret >= size - 1)



More information about the dev mailing list