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 45443A0C43; Mon, 15 Nov 2021 09:56:34 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D325C40E01; Mon, 15 Nov 2021 09:56:33 +0100 (CET) Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by mails.dpdk.org (Postfix) with ESMTP id 5DDFC40141 for ; Mon, 15 Nov 2021 09:56:32 +0100 (CET) Received: from dggeme756-chm.china.huawei.com (unknown [172.30.72.56]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4Ht30118XCz1DJP2; Mon, 15 Nov 2021 16:54:09 +0800 (CST) Received: from [10.67.103.128] (10.67.103.128) by dggeme756-chm.china.huawei.com (10.3.19.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2308.20; Mon, 15 Nov 2021 16:56:29 +0800 Subject: Re: [PATCH v1] app/testpmd: avoid the process ID out of range To: Haiyue Wang , CC: Xiaoyun Li , Lijun Ou , Andrew Rybchenko , Ajit Khaparde , Aman Deep Singh References: <20211115060509.216653-1-haiyue.wang@intel.com> From: "Min Hu (Connor)" Message-ID: <0a42ffde-d5ca-490a-77ff-041203910bd5@huawei.com> Date: Mon, 15 Nov 2021 16:56:29 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.3.1 MIME-Version: 1.0 In-Reply-To: <20211115060509.216653-1-haiyue.wang@intel.com> Content-Type: text/plain; charset="gbk"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.67.103.128] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To dggeme756-chm.china.huawei.com (10.3.19.102) X-CFilter-Loop: Reflected 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 Acked-by: Min Hu (Connor) ÔÚ 2021/11/15 14:05, Haiyue Wang дµÀ: > 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; >