From: Roman Skakun Date: Wed, 6 Jan 2021 11:26:57 +0000 (+0200) Subject: xen/arm: optee: The function identifier is always 32-bit X-Git-Tag: archive/raspbian/4.16.0+51-g0941d6cb-1+rpi1~2^2~42^2~1185 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=ede2583fa1a28a969c5609b86aa82a7ba9f19a26;p=xen.git xen/arm: optee: The function identifier is always 32-bit Per the SMCCC specification (see section 3.1 in ARM DEN 0028D), the function identifier is only stored in the least significant 32-bits. The most significant 32-bits should be ignored. Signed-off-by: Roman Skakun Acked-by: Volodymyr Babchyk [jgrall: Reword the commit message and comment] Acked-by: Julien Grall --- diff --git a/xen/arch/arm/tee/optee.c b/xen/arch/arm/tee/optee.c index ee85359742..9570dc6771 100644 --- a/xen/arch/arm/tee/optee.c +++ b/xen/arch/arm/tee/optee.c @@ -1643,7 +1643,11 @@ static bool optee_handle_call(struct cpu_user_regs *regs) if ( !ctx ) return false; - switch ( get_user_reg(regs, 0) ) + /* + * The function identifier is always stored in the least significant + * 32-bit (see section ARM DEN 0028D). + */ + switch ( (uint32_t)get_user_reg(regs, 0) ) { case OPTEE_SMC_CALLS_COUNT: set_user_reg(regs, 0, OPTEE_MEDIATOR_SMC_COUNT);