DPDK patches and discussions
 help / color / mirror / Atom feed
From: Andy Green <andy@warmcat.com>
To: Matan Azrad <matan@mellanox.com>, "dev@dpdk.org" <dev@dpdk.org>
Subject: Re: [dpdk-dev] [PATCH v5 12/16] net/vdev_netvsc: readlink inputs cannot be aliased
Date: Mon, 14 May 2018 12:54:25 +0800	[thread overview]
Message-ID: <c5eb43d9-cc03-04fa-ede7-2a832dc34748@warmcat.com> (raw)
In-Reply-To: <VI1PR0501MB26084039E218C37833E6FD48D29D0@VI1PR0501MB2608.eurprd05.prod.outlook.com>



On 05/13/2018 03:20 PM, Matan Azrad wrote:
> 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?

Because as the series cover page says, these problems are all coming 
from Fedora 28 + gcc8.0.1 (on x86_64) which has some very cool new 
static analysis features.

In each case gcc8 has complained, the code was broken actually, the 
tools until now were not good enough to tell us the stuff needed fixing 
is why it's coming now.

> 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@warmcat.com>
>> Fixes: e7dc5d7becc5 ("net/vdev_netvsc: implement core functionality")
> What's about backporting it to stable?

That's something for the maintainer(s) to take care about.

> 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.

 From my perspective, which is not that of a paid dev for this project 
who has now spent a week on these patches, functionally it doesn't 
really matter which order those things are in.

If the maintainer really cares he can munge the patches to be what he 
prefers.

If this turns into a job for me and I have more patches later, I will 
try to align with the project-specific requirements better.

>> Acked-by: Pablo de Lara <pablo.de.lara.guarch@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?

You're right, it's just a random pathlength-like number.
I borrowed the sizing code you mentioned from the function below instead 
(whose random pathlength-like number is at least consistent with the 
rest of the code).

>>   	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.

Yes, I changed it thanks.

-Andy

>>   		return -ENOBUFS;
>> -	ret = readlink(buf, buf, size);
>> +	ret = readlink(in, buf, size);
>>   	if (ret == -1)
>>   		return -errno;
>>   	if ((size_t)ret >= size - 1)
> 

  reply	other threads:[~2018-05-14  4:54 UTC|newest]

Thread overview: 54+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-12  1:47 [dpdk-dev] [PATCH v5 00/16] Fix default build on gcc8.0.1 Andy Green
2018-05-12  1:47 ` [dpdk-dev] [PATCH v5 01/16] devtools/check-git: provide more generic grep pattern Andy Green
2018-05-12  1:47 ` [dpdk-dev] [PATCH v5 02/16] net/nfp: solve buffer overflow Andy Green
2018-05-12  1:47 ` [dpdk-dev] [PATCH v5 03/16] bus/pci: replace strncpy dangerous code Andy Green
2018-05-15  6:12   ` Yao, Lei A
2018-05-15  7:31     ` [dpdk-dev] [PATCH] bus/pci: correct the earlier strlcpy conversion Andy Green
2018-05-15 10:51       ` Andrew Rybchenko
2018-05-15 13:19         ` Thomas Monjalon
2018-05-15  7:32     ` [dpdk-dev] [PATCH v5 03/16] bus/pci: replace strncpy dangerous code Andy Green
2018-05-15  8:18       ` Yao, Lei A
2018-05-12  1:48 ` [dpdk-dev] [PATCH v5 04/16] bus/dpaa: solve inconsistent struct alignment Andy Green
2018-05-12  1:48 ` [dpdk-dev] [PATCH v5 05/16] net/axgbe: solve broken eeprom string comp Andy Green
2018-05-12  1:48 ` [dpdk-dev] [PATCH v5 06/16] net/nfp/nfpcore: solve strncpy misuse Andy Green
2018-05-12  1:48 ` [dpdk-dev] [PATCH v5 07/16] net/nfp/nfpcore: off-by-one and no NUL on strncpy use Andy Green
2018-05-12  1:48 ` [dpdk-dev] [PATCH v5 08/16] net/nfp: don't memcpy out of source range Andy Green
2018-05-12  1:48 ` [dpdk-dev] [PATCH v5 09/16] net/qede: strncpy length constant and NUL Andy Green
2018-05-12  1:48 ` [dpdk-dev] [PATCH v5 10/16] net/qede: solve broken strncpy Andy Green
2018-05-12  1:48 ` [dpdk-dev] [PATCH v5 11/16] net/sfc: make sure that copied stats name is NUL-terminated Andy Green
2018-05-12  1:48 ` [dpdk-dev] [PATCH v5 12/16] net/vdev_netvsc: readlink inputs cannot be aliased Andy Green
2018-05-13  7:20   ` Matan Azrad
2018-05-14  4:54     ` Andy Green [this message]
2018-05-12  1:48 ` [dpdk-dev] [PATCH v5 13/16] net/vdev_netvsc: 3 x strncpy misuse Andy Green
2018-05-13  7:47   ` Matan Azrad
2018-05-12  1:48 ` [dpdk-dev] [PATCH v5 14/16] app/proc-info: sprintf overrun bug Andy Green
2018-05-12  1:48 ` [dpdk-dev] [PATCH v5 15/16] app/test-bbdev: strcpy ok for allocated string Andy Green
2018-05-12  1:49 ` [dpdk-dev] [PATCH v5 16/16] " Andy Green
2018-05-14  4:59 ` [dpdk-dev] [PATCH v6 00/16] Fix default build on gcc8.0.1 Andy Green
2018-05-14  4:59   ` [dpdk-dev] [PATCH v6 01/16] devtools/check-git: provide more generic grep pattern Andy Green
2018-05-14 16:28     ` Ferruh Yigit
2018-05-14  5:00   ` [dpdk-dev] [PATCH v6 02/16] net/nfp: solve buffer overflow Andy Green
2018-05-14  5:00   ` [dpdk-dev] [PATCH v6 03/16] bus/pci: replace strncpy dangerous code Andy Green
2018-05-14  5:00   ` [dpdk-dev] [PATCH v6 04/16] bus/dpaa: solve inconsistent struct alignment Andy Green
2018-05-14  5:00   ` [dpdk-dev] [PATCH v6 05/16] net/axgbe: solve broken eeprom string comp Andy Green
2018-05-14  5:00   ` [dpdk-dev] [PATCH v6 06/16] net/nfp/nfpcore: solve strncpy misuse Andy Green
2018-05-14  5:00   ` [dpdk-dev] [PATCH v6 07/16] net/nfp/nfpcore: off-by-one and no NUL on strncpy use Andy Green
2018-05-14  5:00   ` [dpdk-dev] [PATCH v6 08/16] net/nfp: don't memcpy out of source range Andy Green
2018-05-14  5:00   ` [dpdk-dev] [PATCH v6 09/16] net/qede: strncpy length constant and NUL Andy Green
2018-05-14 20:16     ` Ferruh Yigit
2018-05-14  5:00   ` [dpdk-dev] [PATCH v6 10/16] net/qede: solve broken strncpy Andy Green
2018-05-14 20:20     ` Ferruh Yigit
2018-05-14 21:14       ` Ferruh Yigit
2018-05-14 23:04         ` Andy Green
2018-05-14  5:00   ` [dpdk-dev] [PATCH v6 11/16] net/sfc: make sure that copied stats name is NUL-terminated Andy Green
2018-05-14  5:00   ` [dpdk-dev] [PATCH v6 12/16] net/vdev_netvsc: readlink inputs cannot be aliased Andy Green
2018-05-14  5:00   ` [dpdk-dev] [PATCH v6 13/16] net/vdev_netvsc: convert snprintf to strlcpy Andy Green
2018-05-14  5:01   ` [dpdk-dev] [PATCH v6 14/16] app/proc-info: sprintf overrun bug Andy Green
2018-05-14 20:31     ` Ferruh Yigit
2018-05-14  5:01   ` [dpdk-dev] [PATCH v6 15/16] app/test-bbdev: strcpy ok for allocated string Andy Green
2018-05-14 20:42     ` Ferruh Yigit
2018-05-14 20:56       ` Ferruh Yigit
2018-05-14 21:01         ` Ferruh Yigit
2018-05-14  5:01   ` [dpdk-dev] [PATCH v6 16/16] " Andy Green
2018-05-14 21:03     ` Ferruh Yigit
2018-05-14 21:29   ` [dpdk-dev] [PATCH v6 00/16] Fix default build on gcc8.0.1 Ferruh Yigit

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c5eb43d9-cc03-04fa-ede7-2a832dc34748@warmcat.com \
    --to=andy@warmcat.com \
    --cc=dev@dpdk.org \
    --cc=matan@mellanox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).