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 B790CA0524; Wed, 21 Apr 2021 03:17:26 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 35DC041880; Wed, 21 Apr 2021 03:17:14 +0200 (CEST) Received: from szxga05-in.huawei.com (szxga05-in.huawei.com [45.249.212.191]) by mails.dpdk.org (Postfix) with ESMTP id D451C41783 for ; Wed, 21 Apr 2021 03:17:10 +0200 (CEST) Received: from DGGEMS414-HUB.china.huawei.com (unknown [172.30.72.59]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4FQ2dD3WdbzPsWn; Wed, 21 Apr 2021 09:14:08 +0800 (CST) Received: from localhost.localdomain (10.69.192.56) by DGGEMS414-HUB.china.huawei.com (10.3.19.214) with Microsoft SMTP Server id 14.3.498.0; Wed, 21 Apr 2021 09:17:04 +0800 From: "Min Hu (Connor)" To: CC: , , Date: Wed, 21 Apr 2021 09:17:17 +0800 Message-ID: <1618967837-2341-3-git-send-email-humin29@huawei.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1618967837-2341-1-git-send-email-humin29@huawei.com> References: <1618967837-2341-1-git-send-email-humin29@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.69.192.56] X-CFilter-Loop: Reflected Subject: [dpdk-dev] [PATCH 2/2] eal: fix service core index validity 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 Sender: "dev" From: Chengwen Feng This patch adds checking for service core index validity when parsing service corelist. Fixes: 7dbd7a6413ef ("service: add -S corelist option") Cc: stable@dpdk.org Signed-off-by: Chengwen Feng Signed-off-by: Min Hu (Connor) --- lib/librte_eal/common/eal_common_options.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/librte_eal/common/eal_common_options.c b/lib/librte_eal/common/eal_common_options.c index 66f9114..b4da878 100644 --- a/lib/librte_eal/common/eal_common_options.c +++ b/lib/librte_eal/common/eal_common_options.c @@ -785,6 +785,8 @@ eal_parse_service_corelist(const char *corelist) idx = strtoul(corelist, &end, 10); if (errno || end == NULL) return -1; + if (idx < 0 || idx >= RTE_MAX_LCORE) + return -1; while (isblank(*end)) end++; if (*end == '-') { -- 2.7.4