[dpdk-dev] [EXT] [PATCH] trace: fix build with gcc 10
Sunil Kumar Kori
skori at marvell.com
Tue Apr 28 05:48:55 CEST 2020
Sent from Workspace ONE Boxer
On 27-Apr-2020 10:18 PM, Phil Yang <phil.yang at 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/
I have two points:
1. Will this patch resolves both mentioned warnings/error in patch 69382 ?
2. David has suggested another way of doing it. Please check that too.
> Signed-off-by: Phil Yang <phil.yang at arm.com>
> Reviewed-by: Lijian Zhang <lijian.zhang at arm.com>
> Tested-by: Lijian Zhang <lijian.zhang at 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
>
More information about the dev
mailing list