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 E88DBA0C43; Mon, 15 Nov 2021 07:32:39 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6F50B40E01; Mon, 15 Nov 2021 07:32:39 +0100 (CET) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by mails.dpdk.org (Postfix) with ESMTP id AF45940141 for ; Mon, 15 Nov 2021 07:32:38 +0100 (CET) X-IronPort-AV: E=McAfee;i="6200,9189,10168"; a="294207784" X-IronPort-AV: E=Sophos;i="5.87,235,1631602800"; d="scan'208";a="294207784" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Nov 2021 22:32:37 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.87,235,1631602800"; d="scan'208";a="493883261" Received: from npg-dpdk-haiyue-1.sh.intel.com ([10.67.118.194]) by orsmga007.jf.intel.com with ESMTP; 14 Nov 2021 22:32:35 -0800 From: Haiyue Wang To: dev@dpdk.org Cc: Haiyue Wang , Xiaoyun Li , Lijun Ou , Andrew Rybchenko , Ajit Khaparde , Aman Deep Singh Subject: [PATCH v1] app/testpmd: avoid the process ID out of range Date: Mon, 15 Nov 2021 14:05:09 +0800 Message-Id: <20211115060509.216653-1-haiyue.wang@intel.com> X-Mailer: git-send-email 2.33.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 The 'proc-id' should be less than 'num-procs', if not, exit the testpmd and show the error message. Fixes: a550baf24af9 ("app/testpmd: support multi-process") Signed-off-by: Haiyue Wang --- app/test-pmd/parameters.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c index 0974b0a38f..5251722d0f 100644 --- a/app/test-pmd/parameters.c +++ b/app/test-pmd/parameters.c @@ -1527,6 +1527,12 @@ launch_args_parse(int argc, char** argv) rte_exit(EXIT_FAILURE, "Command line is incorrect\n"); } + if (proc_id >= (int)num_procs) + rte_exit(EXIT_FAILURE, + "The multi-process option '%s(%d)' should be less than '%s(%u)'\n", + PARAM_PROC_ID, proc_id, + PARAM_NUM_PROCS, num_procs); + /* Set offload configuration from command line parameters. */ rx_mode.offloads = rx_offloads; tx_mode.offloads = tx_offloads; -- 2.33.1