From df9eb8790b8e49c63beaef93c3194f1b0ed48f4d Mon Sep 17 00:00:00 2001 From: Ian Moffett Date: Wed, 17 Sep 2025 03:11:44 -0400 Subject: kernel/amd64: mp: Use NULL instead of wrapping It is best to return NULL when there is no next CPU instead of wrapping so we have an indicator at where the list ends. Signed-off-by: Ian Moffett --- src/sys/arch/amd64/cpu/cpu_mp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sys/arch/amd64/cpu/cpu_mp.c b/src/sys/arch/amd64/cpu/cpu_mp.c index 3483e4a..28ca6ee 100644 --- a/src/sys/arch/amd64/cpu/cpu_mp.c +++ b/src/sys/arch/amd64/cpu/cpu_mp.c @@ -89,8 +89,8 @@ cpu_get(uint16_t index) return &g_bsp; } - if ((index - 1) >= ncores_up) { - index %= (ncores_up - 1); + if ((index - 1) >= (ncores_up - 1)) { + return NULL; } return corelist[index - 1]; -- cgit v1.2.3