forked from Mirrors/opensbi
		
	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:
		
				
					committed by
					
						
						Anup Patel
					
				
			
			
				
	
			
			
			
						parent
						
							2491242282
						
					
				
				
					commit
					67b2a40892
				
			@@ -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);
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user