From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 2E835A0032; Fri, 18 Feb 2022 16:18:55 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id F3EB84014E; Fri, 18 Feb 2022 16:18:54 +0100 (CET) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by mails.dpdk.org (Postfix) with ESMTP id 9E70F40141; Fri, 18 Feb 2022 16:18:53 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1645197534; x=1676733534; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=bEODpZ3HneUpSxVJjecUBbd8LqY8cDcOKt+M6ZUNuFE=; b=SKc1c7LfFErscnSc9hplNtNAKG3DEEAfAbUSh3BdeczJDW4sSOGuBRTe Fm3feuujP5yIEJ0J3inAE0wLAKLmFtQ4mgnoFf0ZfFYo0Ky8/qIB74Fn8 xqY6nWsaLCsAEtqc18RFyTRxBoLqjo05Rn7J3ViboBHopkDB0TbPWqCM8 0YXTMGP5RFhw7CsnPRuXAAF7kteA8/OigpGFrxWmzuLoLo0cqmPjgKZF0 yWj0RLaEr3ZWGYRhucpd5oGY5H6n48rvLgAjQtXGdGIOJ2OZpcgKtcpYv 9LCqEnn/HBUN9p7/0LhWR76Fu1/ZiRpVJyC0oWJeQy6QK/itsX4F2RJBb A==; X-IronPort-AV: E=McAfee;i="6200,9189,10261"; a="337587994" X-IronPort-AV: E=Sophos;i="5.88,379,1635231600"; d="scan'208";a="337587994" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Feb 2022 07:18:52 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.88,379,1635231600"; d="scan'208";a="530952359" Received: from silpixa00401214.ir.intel.com ([10.55.129.112]) by orsmga007.jf.intel.com with ESMTP; 18 Feb 2022 07:18:50 -0800 From: Reshma Pattan To: dev@dpdk.org Cc: stephen@networkplumber.org, ferruh.yigit@intel.com, Reshma Pattan , vipin.varghese@intel.com, stable@dpdk.org Subject: [PATCH] app/pdump: check lcore is not the maximum core Date: Fri, 18 Feb 2022 15:18:41 +0000 Message-Id: <20220218151841.116135-1-reshma.pattan@intel.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 Check lcore id value is not the maximum core supported. Using lcore id without this check might cause out of bound access inside the rte_eal_wait_lcore. Coverity issue: 375841 Fixes: b2854d5317e8 ("app/pdump: support multi-core capture") Cc: vipin.varghese@intel.com Cc: stable@dpdk.org Signed-off-by: Reshma Pattan --- app/pdump/main.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/app/pdump/main.c b/app/pdump/main.c index 04a38e8911..686c27d965 100644 --- a/app/pdump/main.c +++ b/app/pdump/main.c @@ -931,11 +931,19 @@ dump_packets(void) } lcore_id = rte_get_next_lcore(lcore_id, 1, 0); + if (lcore_id == RTE_MAX_LCORE) { + printf("Invalid core %u for the packet capture!\n", lcore_id); + return; + } for (i = 0; i < num_tuples; i++) { rte_eal_remote_launch(dump_packets_core, &pdump_t[i], lcore_id); lcore_id = rte_get_next_lcore(lcore_id, 1, 0); + if (lcore_id == RTE_MAX_LCORE) { + printf("Invalid core %u for the capture for the tuple=%d!\n", lcore_id, i); + return; + } if (rte_eal_wait_lcore(lcore_id) < 0) rte_exit(EXIT_FAILURE, "failed to wait\n"); -- 2.25.1