From patchwork Thu Jun 16 10:22:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Wu, WenxuanX" X-Patchwork-Id: 112890 Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id F2030A00BE; Thu, 16 Jun 2022 12:22:35 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D98A74281E; Thu, 16 Jun 2022 12:22:35 +0200 (CEST) Received: from mga06.intel.com (mga06b.intel.com [134.134.136.31]) by mails.dpdk.org (Postfix) with ESMTP id 7D6D8410E8; Thu, 16 Jun 2022 12:22:33 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1655374953; x=1686910953; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=sPud+mCPVP2n/ALhBxpMm5hh3m2USieI2fwGNJ75VnY=; b=Iiac9m0/fodVQ7S6DlB408iI4N4pi2+kiYavj908f1WumwSfG0RklGLS WS1V48R+9vuPhbMuuF22eDka7txxzL1JheWK5T3xcciT/gE+GkLwL/ycF XRwrb/Kpp5Q2QS/MsmwkP34q9XxFg8MypeNt6wFYKwgxo+JOxE3YM9tAl 3Xi8IHQOp0TgEJkCwmjWEZYCb2imjxTaK9Hq3Z/xU6HuiwlD32Q2zB3mG 6niyu2gm/U8+7AS5KUljdrOHq551Nt7tGrzaZ4DheLmwspHVYicZ4f/Xe 7C2qEWNE5YlTVzoMan+juZ9jHdfcGC3k3GqRPuGP9sDvbSS1wp9j2bOiN w==; X-IronPort-AV: E=McAfee;i="6400,9594,10379"; a="340872077" X-IronPort-AV: E=Sophos;i="5.91,304,1647327600"; d="scan'208";a="340872077" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Jun 2022 03:22:32 -0700 X-IronPort-AV: E=Sophos;i="5.91,304,1647327600"; d="scan'208";a="589583671" Received: from unknown (HELO localhost.localdomain) ([10.239.252.3]) by fmsmga007-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Jun 2022 03:22:30 -0700 From: wenxuanx.wu@intel.com To: wisamm@nvidia.com, dev@dpdk.org Cc: Wenxuan Wu , stable@dpdk.org Subject: [PATCH 1/2] app: fix gcc 12 array bounds warning Date: Thu, 16 Jun 2022 18:22:09 +0800 Message-Id: <20220616102209.130871-1-wenxuanx.wu@intel.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org From: Wenxuan Wu when n == 1000, and it would be overflow the array size of 4 bytes with nul terminator. Change the logic to avoid this warning. Fixes: 15c431864000 ("app/flow-perf: add packet forwarding support") Cc: stable@dpdk.org Signed-off-by: Wenxuan Wu --- app/test-flow-perf/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/test-flow-perf/main.c b/app/test-flow-perf/main.c index 56d43734e3..661d562158 100644 --- a/app/test-flow-perf/main.c +++ b/app/test-flow-perf/main.c @@ -1728,7 +1728,7 @@ pretty_number(uint64_t n, char *buf) int i = 0; int off = 0; - while (n > 1000) { + while (n >= 1000) { sprintf(p[i], "%03d", (int)(n % 1000)); n /= 1000; i += 1;