mirror of
https://github.com/riscv-software-src/opensbi.git
synced 2025-11-22 19:01:33 +00:00
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:
committed by
Anup Patel
parent
976a6a8612
commit
fade4399d2
@@ -136,7 +136,7 @@ void plic_suspend(void)
|
||||
return;
|
||||
|
||||
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)
|
||||
continue;
|
||||
@@ -167,7 +167,7 @@ void plic_resume(void)
|
||||
return;
|
||||
|
||||
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)
|
||||
continue;
|
||||
|
||||
Reference in New Issue
Block a user