From patchwork Thu Jun 16 10:26:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Wu, WenxuanX" X-Patchwork-Id: 112891 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 B5B4BA00BE; Thu, 16 Jun 2022 12:27:50 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6F25A410E8; Thu, 16 Jun 2022 12:27:50 +0200 (CEST) Received: from mga06.intel.com (mga06b.intel.com [134.134.136.31]) by mails.dpdk.org (Postfix) with ESMTP id 672104003C; Thu, 16 Jun 2022 12:27:48 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1655375268; x=1686911268; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=79vATVrRGupGxmJD5G6wWknhydVLjz6LG4kQJes68rA=; b=jbkwSDhFeXlUwIxCOzM5dSAmi/XhnGAUAEp6uQH/VzkD87HZk8PAo+nY kxB+Qcx4B4tPMUcUeXqY2DA4mVmtnU/EFaRK3G2HE+yBRclKM7Ov6WHHS rvlvnj8IYego+foeHwSNdIVkDUEyFCKJhIbOZyQ5QvzKhTAnVhqJej1ee PD4GeascaSx96iikSpskrsOmDu6gXdrBhqZLk/TRuUyD2/7y7/KAlHnfM CYKl/9PwHYI1jWa4verhBsefGmzvPowo2j3XM/4PKOJD4dNRyT7CUDkgi d0MK/Fa65a1JX/tqWGI2VvDo4yOBXTP5oiEjrfQTdarX6ybHcpXG5FZpU A==; X-IronPort-AV: E=McAfee;i="6400,9594,10379"; a="340872955" X-IronPort-AV: E=Sophos;i="5.91,304,1647327600"; d="scan'208";a="340872955" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Jun 2022 03:26:33 -0700 X-IronPort-AV: E=Sophos;i="5.91,304,1647327600"; d="scan'208";a="641479682" 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:26:31 -0700 From: wenxuanx.wu@intel.com To: wisamm@nvidia.com, dev@dpdk.org Cc: Wenxuan Wu , stable@dpdk.org Subject: [PATCH] app: fix gcc 12 array bounds warning Date: Thu, 16 Jun 2022 18:26:13 +0800 Message-Id: <20220616102613.131685-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;