rte_lcore_to_socket_id did not check the lcore_id
range before accessing an array with RTE_MAX_LCORE
elements.

Signed-off-by: Markus Theil <markus.th...@tu-ilmenau.de>
---
 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 812e62bcb3..af53efcc24 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

Reply via email to