DPDK patches and discussions
 help / color / mirror / Atom feed
From: Phil Yang <Phil.Yang@arm.com>
To: Sunil Kumar Kori <skori@marvell.com>,
	"jerinj@marvell.com" <jerinj@marvell.com>,
	"dev@dpdk.org" <dev@dpdk.org>
Cc: David Marchand <david.marchand@redhat.com>,
	Ruifeng Wang <Ruifeng.Wang@arm.com>,
	Lijian Zhang <Lijian.Zhang@arm.com>, nd <nd@arm.com>,
	 nd <nd@arm.com>
Subject: Re: [dpdk-dev] [EXT] [PATCH] trace: fix build with gcc 10
Date: Tue, 28 Apr 2020 07:00:19 +0000	[thread overview]
Message-ID: <VE1PR08MB46405B8B3321CF1BE6E66882E9AC0@VE1PR08MB4640.eurprd08.prod.outlook.com> (raw)
In-Reply-To: <86896e98-d87c-4bf9-944e-ee911b76ef80@marvell.com>

From: Sunil Kumar Kori <skori@marvell.com> 
Sent: Tuesday, April 28, 2020 11:49 AM
To: Phil Yang <Phil.Yang@arm.com>; jerinj@marvell.com; dev@dpdk.org
Cc: David Marchand <david.marchand@redhat.com>; Ruifeng Wang <Ruifeng.Wang@arm.com>; Lijian Zhang <Lijian.Zhang@arm.com>; nd <nd@arm.com>
Subject: [EXT] [PATCH] trace: fix build with gcc 10

Sent from Workspace ONE Boxer
On 27-Apr-2020 10:18 PM, Phil Yang <mailto:phil.yang@arm.com> wrote: 
>
> External Email 
>
> ---------------------------------------------------------------------- 
> GCC 10 compiling output: 
> eal_common_trace_utils.c: In function 'eal_trace_dir_args_save': 
> eal_common_trace_utils.c:290:24: error: '__builtin___sprintf_chk'   \ 
>         may write a terminating nul past the end of the destination \ 
>         [-Werror=format-overflow=] 
>   290 |  sprintf(dir_path, "%s/", optarg); 
>       |                        ^ 
>
> Fixes: 8af866df8d8c ("trace: add trace directory configuration parameter") 
>
Hello, there is one more thread going on regarding this. Please have a look on below patch. 
http://patches.dpdk.org/patch/69382/

Hi Sunil,

Sorry, I didn’t notice that. Thanks for the link. 

I have two points:
1. Will this patch resolves both mentioned warnings/error in  patch 69382 ?
[Phil] Yes, this patch resolved the same issue mentioned by David in patch 69382.

2. David has suggested another way of doing it. Please check that too.
[Phil]  I think both David’s and my patches are correct.
My patch can guarantee a correct ‘size’ information in snprinf(). It omits the memory allocation operation for the incorrect input arguments case.
David’s suggestion resolves the potential directory copy fail issue and it saves some memory space in the normal case. But it needs to allocate memory in the incorrect input case.

So, I think we can bind these two patches together?

Thanks,
Phil

> Signed-off-by: Phil Yang <mailto:phil.yang@arm.com> 
> Reviewed-by: Lijian Zhang <mailto:lijian.zhang@arm.com> 
> Tested-by: Lijian Zhang <mailto:lijian.zhang@arm.com> 
> --- 
>  lib/librte_eal/common/eal_common_trace_utils.c | 5 ++++- 
>  1 file changed, 4 insertions(+), 1 deletion(-) 
>
> diff --git a/lib/librte_eal/common/eal_common_trace_utils.c b/lib/librte_eal/common/eal_common_trace_utils.c 
> index fce8892..c079642 100644 
> --- a/lib/librte_eal/common/eal_common_trace_utils.c 
> +++ b/lib/librte_eal/common/eal_common_trace_utils.c 
> @@ -276,7 +276,10 @@ eal_trace_dir_args_save(char const *optarg) 
>                  return -EINVAL; 
>          } 
>   
> -       if (strlen(optarg) >= size) { 
> +       /* the specified trace directory name cannot 
> +        * exceed PATH_MAX-1. 
> +        */ 
> +       if (strlen(optarg) >= (size - 1)) { 
>                  trace_err("input string is too big"); 
>                  return -ENAMETOOLONG; 
>          } 
> -- 
> 2.7.4 
>


  reply	other threads:[~2020-04-28  7:00 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-27 16:47 [dpdk-dev] " Phil Yang
2020-04-27 16:58 ` Stephen Hemminger
2020-04-28  7:15   ` Phil Yang
2020-04-28  3:48 ` [dpdk-dev] [EXT] " Sunil Kumar Kori
2020-04-28  7:00   ` Phil Yang [this message]
2020-04-28 10:52     ` Sunil Kumar Kori
2020-04-28 13:50       ` Phil Yang
2020-04-28 14:37 ` [dpdk-dev] [PATCH v2] " Phil Yang
2020-04-30 13:51   ` [dpdk-dev] [EXT] " Sunil Kumar Kori

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=VE1PR08MB46405B8B3321CF1BE6E66882E9AC0@VE1PR08MB4640.eurprd08.prod.outlook.com \
    --to=phil.yang@arm.com \
    --cc=Lijian.Zhang@arm.com \
    --cc=Ruifeng.Wang@arm.com \
    --cc=david.marchand@redhat.com \
    --cc=dev@dpdk.org \
    --cc=jerinj@marvell.com \
    --cc=nd@arm.com \
    --cc=skori@marvell.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).