mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-11 15:37:23 +00:00
riscv: treat undefined exception codes as reserved
Undefined exception codes currently lead to an out-of-bounds array access. Prevent this by treating undefined exception codes as "reserved". Signed-off-by: Lukas Auer <lukas.auer@aisec.fraunhofer.de> Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Rick Chen <rick@andestech.com>
This commit is contained in:
parent
5a441736b7
commit
e8b522b1df
1 changed files with 6 additions and 2 deletions
|
@ -81,6 +81,10 @@ static void _exit_trap(ulong code, ulong epc, struct pt_regs *regs)
|
|||
"Store/AMO page fault",
|
||||
};
|
||||
|
||||
printf("exception code: %ld , %s , epc %lx , ra %lx\n",
|
||||
code, exception_code[code], epc, regs->ra);
|
||||
if (code < ARRAY_SIZE(exception_code)) {
|
||||
printf("exception code: %ld , %s , epc %lx , ra %lx\n",
|
||||
code, exception_code[code], epc, regs->ra);
|
||||
} else {
|
||||
printf("Reserved\n");
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue