summaryrefslogtreecommitdiff
path: root/platform
diff options
context:
space:
mode:
authorBin Meng <bmeng@tinylab.org>2022-12-11 09:54:21 +0300
committerAnup Patel <anup@brainfault.org>2022-12-17 06:30:29 +0300
commit8509e46ca63a4ed7dff2244cd7f288bf5591ab61 (patch)
tree17f2815b39328279f9459d09e106c8a31660442a /platform
parent34da6638ad7b3d8c1834dffe5cd2629aa748efaf (diff)
downloadopensbi-8509e46ca63a4ed7dff2244cd7f288bf5591ab61.tar.xz
lib: utils/irqchip: plic: Ensure no out-of-bound access in priority save/restore helpers
Currently the priority save/restore helpers writes/reads the provided array using an index whose maximum value is determined by PLIC, which potentially may disagree with the caller to these helpers. Add a parameter to ask the caller to provide the size limit of the array to ensure no out-of-bound access happens. Signed-off-by: Bin Meng <bmeng@tinylab.org> Reviewed-by: Anup Patel <anup@brainfault.org>
Diffstat (limited to 'platform')
-rw-r--r--platform/generic/allwinner/sun20i-d1.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/platform/generic/allwinner/sun20i-d1.c b/platform/generic/allwinner/sun20i-d1.c
index 18d330d..1f27575 100644
--- a/platform/generic/allwinner/sun20i-d1.c
+++ b/platform/generic/allwinner/sun20i-d1.c
@@ -79,13 +79,13 @@ static u32 plic_threshold;
static void sun20i_d1_plic_save(void)
{
fdt_plic_context_save(true, plic_sie, &plic_threshold);
- fdt_plic_priority_save(plic_priority);
+ fdt_plic_priority_save(plic_priority, PLIC_SOURCES);
}
static void sun20i_d1_plic_restore(void)
{
thead_plic_restore();
- fdt_plic_priority_restore(plic_priority);
+ fdt_plic_priority_restore(plic_priority, PLIC_SOURCES);
fdt_plic_context_restore(true, plic_sie, plic_threshold);
}