mirror of
https://github.com/Fishwaldo/opensbi.git
synced 2025-03-16 03:41:24 +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;
|
||||
sbi_trap_redirect(regs, &trap);
|
||||
} else {
|
||||
if (ret < SBI_LAST_ERR) {
|
||||
if (ret < SBI_LAST_ERR || SBI_SUCCESS < ret) {
|
||||
sbi_printf("%s: Invalid error %d for ext=0x%lx "
|
||||
"func=0x%lx\n", __func__, ret,
|
||||
extension_id, func_id);
|
||||
|
|
Loading…
Add table
Reference in a new issue