Commit 12890f7b authored by Sudeep Holla's avatar Sudeep Holla Committed by Lee Jones
Browse files

UPSTREAM: firmware: arm_ffa: Explicitly cast return value from FFA_VERSION before comparison



The return value ver.a0 is unsigned long type and FFA_RET_NOT_SUPPORTED
is a negative value.

Since the return value from the firmware can be just 32-bit even on
64-bit systems as FFA specification mentions it as int32 error code in
w0 register, explicitly casting to s32 ensures correct sign interpretation
when comparing against a signed error code FFA_RET_NOT_SUPPORTED.

Without casting, comparison between unsigned long and a negative
constant could lead to unintended results due to type promotions.

Bug: 254441685
Fixes: 3bbfe987 ("firmware: arm_ffa: Add initial Arm FFA driver support")
Reported-by: default avatarAndrei Homescu <ahomescu@google.com>
Message-Id: <20250221095633.506678-1-sudeep.holla@arm.com>
Signed-off-by: default avatarSudeep Holla <sudeep.holla@arm.com>
(cherry picked from commit cecf6a50)
Signed-off-by: default avatarLee Jones <joneslee@google.com>
Change-Id: Ic0cbae51cd3221c6f24297054c35ebc8b844f4de
parent 3e994c27
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment