All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 1/5] lib: utils/irqchip: plic: Fix the off-by-one error in priority save/restore helpers
@ 2022-12-11  6:54 Bin Meng
  2022-12-11  6:54 ` [PATCH v3 2/5] lib: utils/irqchip: plic: Ensure no out-of-bound access " Bin Meng
                   ` (5 more replies)
  0 siblings, 6 replies; 27+ messages in thread
From: Bin Meng @ 2022-12-11  6:54 UTC (permalink / raw)
  To: opensbi

Interrupt source 0 is reserved. Hence the irq should start from 1.

Fixes: 2b79b694a805 ("lib: irqchip/plic: Add priority save/restore helpers")
Signed-off-by: Bin Meng <bmeng@tinylab.org>
Reviewed-by: Anup Patel <anup@brainfault.org>
---

(no changes since v1)

 lib/utils/irqchip/plic.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/utils/irqchip/plic.c b/lib/utils/irqchip/plic.c
index 73d7788..4df9020 100644
--- a/lib/utils/irqchip/plic.c
+++ b/lib/utils/irqchip/plic.c
@@ -38,13 +38,13 @@ static void plic_set_priority(const struct plic_data *plic, u32 source, u32 val)
 
 void plic_priority_save(const struct plic_data *plic, u8 *priority)
 {
-	for (u32 i = 0; i < plic->num_src; i++)
+	for (u32 i = 1; i <= plic->num_src; i++)
 		priority[i] = plic_get_priority(plic, i);
 }
 
 void plic_priority_restore(const struct plic_data *plic, const u8 *priority)
 {
-	for (u32 i = 0; i < plic->num_src; i++)
+	for (u32 i = 1; i <= plic->num_src; i++)
 		plic_set_priority(plic, i, priority[i]);
 }
 
-- 
2.34.1



^ permalink raw reply related	[flat|nested] 27+ messages in thread

end of thread, other threads:[~2022-12-17 12:50 UTC | newest]

Thread overview: 27+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-12-11  6:54 [PATCH v3 1/5] lib: utils/irqchip: plic: Fix the off-by-one error in priority save/restore helpers Bin Meng
2022-12-11  6:54 ` [PATCH v3 2/5] lib: utils/irqchip: plic: Ensure no out-of-bound access " Bin Meng
2022-12-11 12:03   ` Anup Patel
2022-12-11 12:11   ` Andreas Schwab
2022-12-12  6:45     ` Samuel Holland
2022-12-12  7:04   ` Samuel Holland
2022-12-17  3:27     ` Anup Patel
2022-12-17  3:40   ` Anup Patel
2022-12-11  6:54 ` [PATCH v3 3/5] lib: utils/irqchip: plic: Fix the off-by-one error in plic_context_init() Bin Meng
2022-12-12  6:49   ` Samuel Holland
2022-12-17  3:40   ` Anup Patel
2022-12-11  6:54 ` [PATCH v3 4/5] lib: utils/irqchip: plic: Fix the off-by-one error in context save/restore helpers Bin Meng
2022-12-12  6:57   ` Samuel Holland
2022-12-17  3:40   ` Anup Patel
2022-12-11  6:54 ` [PATCH v3 5/5] lib: utils/irqchip: plic: Ensure no out-of-bound access " Bin Meng
2022-12-11 12:06   ` Anup Patel
2022-12-12  7:00   ` Samuel Holland
2022-12-17  3:39     ` Anup Patel
2022-12-17  3:41   ` Anup Patel
2022-12-11 10:07 ` [PATCH v3 1/5] lib: utils/irqchip: plic: Fix the off-by-one error in priority " Andreas Schwab
2022-12-11 10:18   ` Bin Meng
2022-12-11 10:52     ` Andreas Schwab
2022-12-11 12:11     ` Andreas Schwab
2022-12-12  6:40     ` Samuel Holland
2022-12-17  3:21       ` Anup Patel
2022-12-17 12:50         ` Andreas Schwab
2022-12-17  3:40 ` Anup Patel

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.