From c1e03843676aa714d9354554a507346f50577ac5 Mon Sep 17 00:00:00 2001 From: Ziang Wang Date: Thu, 25 Sep 2025 16:03:54 +0800 Subject: [PATCH] arch/riscv/include: Cast 'id' to int in OTHER_HLS() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The 'id' in OTHER_HSL macro is non-typed, downflow would occur when ‘id’ is unsigned and less greater than hart_id. Cast it to int. Change-Id: I777337b7e374024aff6fb36de603b799b1a65371 Signed-off-by: Ziang Wang Reviewed-on: https://review.coreboot.org/c/coreboot/+/89338 Tested-by: build bot (Jenkins) Reviewed-by: Maximilian Brune --- src/arch/riscv/include/mcall.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/arch/riscv/include/mcall.h b/src/arch/riscv/include/mcall.h index 69eb5741ef..7eb7f6c1eb 100644 --- a/src/arch/riscv/include/mcall.h +++ b/src/arch/riscv/include/mcall.h @@ -62,7 +62,8 @@ register uintptr_t current_stack_pointer asm("sp"); // hart-local storage, at top of stack #define HLS() ((struct hls *)(MACHINE_STACK_TOP() - HLS_SIZE)) -#define OTHER_HLS(id) ((struct hls *)((void *)HLS() + RISCV_PGSIZE * ((id) - HLS()->hart_id))) +#define OTHER_HLS(id) \ + ((struct hls *)((void *)HLS() + RISCV_PGSIZE * (((int)id) - HLS()->hart_id))) #define MACHINE_STACK_SIZE RISCV_PGSIZE