mirror of
https://github.com/Fishwaldo/opensbi.git
synced 2025-07-08 05:58:59 +00:00
lib: sbi: sbi_ecall: Check the range of SBI error
We should also check if the return error code is greater than 0 (SBI_SUCCESS), as this is an invalid error. Signed-off-by: Yu Chien Peter Lin <peterlin@andestech.com> Reviewed-by: Xiang W <wxjstz@126.com> Reviewed-by: Andrew Jones <ajones@ventanamicro.com> Reviewed-by: Anup Patel <anup@brainfault.org>
This commit is contained in:
parent
2491242282
commit
67b2a40892
1 changed files with 1 additions and 1 deletions
|
@ -120,7 +120,7 @@ int sbi_ecall_handler(struct sbi_trap_regs *regs)
|
||||||
trap.epc = regs->mepc;
|
trap.epc = regs->mepc;
|
||||||
sbi_trap_redirect(regs, &trap);
|
sbi_trap_redirect(regs, &trap);
|
||||||
} else {
|
} else {
|
||||||
if (ret < SBI_LAST_ERR) {
|
if (ret < SBI_LAST_ERR || SBI_SUCCESS < ret) {
|
||||||
sbi_printf("%s: Invalid error %d for ext=0x%lx "
|
sbi_printf("%s: Invalid error %d for ext=0x%lx "
|
||||||
"func=0x%lx\n", __func__, ret,
|
"func=0x%lx\n", __func__, ret,
|
||||||
extension_id, func_id);
|
extension_id, func_id);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue