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 F232AA00C3; Fri, 14 Oct 2022 08:21:20 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6DC6F42C48; Fri, 14 Oct 2022 08:21:16 +0200 (CEST) Received: from smail.rz.tu-ilmenau.de (smail.rz.tu-ilmenau.de [141.24.186.67]) by mails.dpdk.org (Postfix) with ESMTP id B6B1E4021E for ; Fri, 14 Oct 2022 08:21:14 +0200 (CEST) Received: from isengard.fritz.box (p54aef542.dip0.t-ipconnect.de [84.174.245.66]) by smail.rz.tu-ilmenau.de (Postfix) with ESMTPA id 75084580099; Fri, 14 Oct 2022 08:21:14 +0200 (CEST) From: Markus Theil To: dev@dpdk.org Cc: Markus Theil Subject: [PATCH 2/2] eal: prevent OOB read in rte_lcore_to_socket_id Date: Fri, 14 Oct 2022 08:21:00 +0200 Message-Id: <20221014062100.5761-2-markus.theil@tu-ilmenau.de> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221014062100.5761-1-markus.theil@tu-ilmenau.de> References: <20221014062100.5761-1-markus.theil@tu-ilmenau.de> 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 Signed-off-by: Markus Theil --- lib/eal/common/eal_common_lcore.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/eal/common/eal_common_lcore.c b/lib/eal/common/eal_common_lcore.c index 48c333cff1..94625c2ebc 100644 --- a/lib/eal/common/eal_common_lcore.c +++ b/lib/eal/common/eal_common_lcore.c @@ -111,6 +111,9 @@ unsigned int rte_get_next_lcore(unsigned int i, int skip_main, int wrap) unsigned int rte_lcore_to_socket_id(unsigned int lcore_id) { + if (unlikely(lcore_id >= RTE_MAX_LCORE)) + return -1; + return lcore_config[lcore_id].socket_id; } -- 2.38.0