From patchwork Thu Jun 16 10:39:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Wu, WenxuanX" X-Patchwork-Id: 112893 X-Patchwork-Delegate: ferruh.yigit@amd.com 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 99641A00BE; Thu, 16 Jun 2022 12:40:08 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 78FD7410D3; Thu, 16 Jun 2022 12:40:08 +0200 (CEST) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by mails.dpdk.org (Postfix) with ESMTP id AA8E54003C; Thu, 16 Jun 2022 12:40:06 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1655376007; x=1686912007; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=Re52FBq6HXqa6oq8iY9ReR2ZaKTdx4KBT1GFrTmm8kw=; b=YI/VnMErwK+ApDfhr4LGdG/VmvKUF1165WEquOYBsilDAJnnTnHQPpqW q/RxC67weSpREpoIWx9ZZSfUjCP9V97u2+QQFg/qPMWvP1+HvEP4yoeA0 XpOs0EKR3fLvea6p9BRcZ2WA9ZpCfJtGmDXrq1AaDNW2U5J9kJwznBpuC KN8xJGVRjMiZSDeXRp4CrJ2U5TUKNprij09i+ZNIdBuztMp9QuUQFANqY N8cMMKxnD7U94w5Zj5fxHv2he0yjuntHUYUvXVtJ0XBHojVkrTcDk5dwU toOxVNpbOluEU9f2AAiaQxaIuxsDGMunwIzxJTe2kDMymHH1PPZB9+ZAa g==; X-IronPort-AV: E=McAfee;i="6400,9594,10379"; a="262239598" X-IronPort-AV: E=Sophos;i="5.91,304,1647327600"; d="scan'208";a="262239598" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Jun 2022 03:40:05 -0700 X-IronPort-AV: E=Sophos;i="5.91,304,1647327600"; d="scan'208";a="641484390" Received: from unknown (HELO localhost.localdomain) ([10.239.252.3]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Jun 2022 03:40:02 -0700 From: wenxuanx.wu@intel.com To: wisamm@nvidia.com, dev@dpdk.org, thomas@monjalon.net Cc: stephen@networkplumber.org, wenxuanx.wu@intel.com, stable@dpdk.org Subject: [PATCH] app: fix gcc 12 array bounds warning Date: Thu, 16 Jun 2022 18:39:44 +0800 Message-Id: <20220616103944.132686-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 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;