summaryrefslogtreecommitdiff
path: root/lib/sbi/sbi_ecall.c
diff options
context:
space:
mode:
authorAtish Patra <atish.patra@wdc.com>2020-02-12 04:39:45 +0300
committerAnup Patel <anup@brainfault.org>2020-02-13 07:27:22 +0300
commit1a8ca08cc037c65c605e7e2f98b8c01606eaca3b (patch)
tree57bb07fa0b0ccfc6d3df6e96b5609affaaa82f56 /lib/sbi/sbi_ecall.c
parent897b8fbdd92fcfad194417d348b8dad16ab0e17a (diff)
downloadopensbi-1a8ca08cc037c65c605e7e2f98b8c01606eaca3b.tar.xz
lib: Initialize out value in SBI calls
As per the SBI specification, the return value in sbiret is undefined if not explicitly described in the function. However, supervisor may check this value by mistake and get a garbage value. Initialize it to zero to avoid nasty supervisor bugs. Signed-off-by: Atish Patra <atish.patra@wdc.com> Reviewed-by: Anup Patel <anup.patel@wdc.com>
Diffstat (limited to 'lib/sbi/sbi_ecall.c')
-rw-r--r--lib/sbi/sbi_ecall.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/sbi/sbi_ecall.c b/lib/sbi/sbi_ecall.c
index e52a654..82397c4 100644
--- a/lib/sbi/sbi_ecall.c
+++ b/lib/sbi/sbi_ecall.c
@@ -79,7 +79,7 @@ int sbi_ecall_handler(u32 hartid, ulong mcause, struct sbi_trap_regs *regs,
unsigned long extension_id = regs->a7;
unsigned long func_id = regs->a6;
struct sbi_trap_info trap = {0};
- unsigned long out_val;
+ unsigned long out_val = 0;
bool is_0_1_spec = 0;
unsigned long args[6];