From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id B7B5CA00BE; Mon, 27 Apr 2020 18:48:11 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 2475C1D519; Mon, 27 Apr 2020 18:48:11 +0200 (CEST) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by dpdk.org (Postfix) with ESMTP id 99BEF1D516 for ; Mon, 27 Apr 2020 18:48:09 +0200 (CEST) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 09D0B31B; Mon, 27 Apr 2020 09:48:09 -0700 (PDT) Received: from phil-VirtualBox.arm.com (A010647.Arm.com [10.170.243.152]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id DC82D3F68F; Mon, 27 Apr 2020 09:48:06 -0700 (PDT) From: Phil Yang To: jerinj@marvell.com, skori@marvell.com, dev@dpdk.org Cc: david.marchand@redhat.com, lijian.zhang@arm.com, ruifeng.wang@arm.com, nd@arm.com Date: Tue, 28 Apr 2020 00:47:38 +0800 Message-Id: <1588006058-10728-1-git-send-email-phil.yang@arm.com> X-Mailer: git-send-email 2.7.4 Subject: [dpdk-dev] [PATCH] trace: fix build with gcc 10 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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") Signed-off-by: Phil Yang Reviewed-by: Lijian Zhang Tested-by: Lijian Zhang --- 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