lib: utils/irqchip: plic: context_id is signed

Array context_id in struct plic_data has elements of type s16.
A negative valid indicates an invalid entry.
Copying the array element to a u32 scalar hides the sign.

Use s16 as target type when copying an array element to a scalar.

Addresses-Coverity-ID: 1667176 Unsigned compared against 0
Addresses-Coverity-ID: 1667178 Logically dead code
Addresses-Coverity-ID: 1667179 Unsigned compared against 0
Addresses-Coverity-ID: 1667182 Logically dead code
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Anup Patel <anup@brainfault.org>
Link: https://lore.kernel.org/r/20251105110121.47130-1-heinrich.schuchardt@canonical.com
Signed-off-by: Anup Patel <anup@brainfault.org>
This commit is contained in:
Heinrich Schuchardt
2025-11-05 12:01:21 +01:00
committed by Anup Patel
parent 976a6a8612
commit fade4399d2

View File

@@ -136,7 +136,7 @@ void plic_suspend(void)
return; return;
sbi_for_each_hartindex(h) { sbi_for_each_hartindex(h) {
u32 context_id = plic->context_map[h][PLIC_S_CONTEXT]; s16 context_id = plic->context_map[h][PLIC_S_CONTEXT];
if (context_id < 0) if (context_id < 0)
continue; continue;
@@ -167,7 +167,7 @@ void plic_resume(void)
return; return;
sbi_for_each_hartindex(h) { sbi_for_each_hartindex(h) {
u32 context_id = plic->context_map[h][PLIC_S_CONTEXT]; s16 context_id = plic->context_map[h][PLIC_S_CONTEXT];
if (context_id < 0) if (context_id < 0)
continue; continue;