[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[xen staging] xen/arm: optee: The function identifier is always 32-bit



commit ede2583fa1a28a969c5609b86aa82a7ba9f19a26
Author:     Roman Skakun <roman_skakun@xxxxxxxx>
AuthorDate: Wed Jan 6 13:26:57 2021 +0200
Commit:     Julien Grall <jgrall@xxxxxxxxxx>
CommitDate: Fri Jan 8 10:24:23 2021 +0000

    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 <roman_skakun@xxxxxxxx>
    Acked-by: Volodymyr Babchyk <volodymyr_babchuk@xxxxxxxx>
    [jgrall: Reword the commit message and comment]
    Acked-by: Julien Grall <jgrall@xxxxxxxxxx>
---
 xen/arch/arm/tee/optee.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

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);
--
generated by git-patchbot for /home/xen/git/xen.git#staging



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.