aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHeinrich Schuchardt <heinrich.schuchardt@canonical.com>2025-11-05 12:01:21 +0100
committerAnup Patel <anup@brainfault.org>2025-11-10 13:44:17 +0530
commitfade4399d2a47a3ff9c5ecd5dd4c3cba7a4eace7 (patch)
treeb73b1846a7e847d02f9e2387f59d2eac45e2bbe2
parent976a6a86124d5d281217444f39ef46dced5b6c47 (diff)
downloadopensbi-fade4399d2a47a3ff9c5ecd5dd4c3cba7a4eace7.tar.gz
opensbi-fade4399d2a47a3ff9c5ecd5dd4c3cba7a4eace7.tar.bz2
opensbi-fade4399d2a47a3ff9c5ecd5dd4c3cba7a4eace7.zip
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>
-rw-r--r--lib/utils/irqchip/plic.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/utils/irqchip/plic.c b/lib/utils/irqchip/plic.c
index 581a41bb..7989a962 100644
--- a/lib/utils/irqchip/plic.c
+++ b/lib/utils/irqchip/plic.c
@@ -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;