Skip to content

Commit 3e282f4

Browse files
committed
firmware: arm_ffa: Explicitly cast return value from NOTIFICATION_INFO_GET
The return value ret.a2 is of type unsigned long and FFA_RET_NO_DATA 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_NO_DATA. Without casting, comparison between unsigned long and a negative constant could lead to unintended results due to type promotions. Fixes: 3522be4 ("firmware: arm_ffa: Implement the NOTIFICATION_INFO_GET interface") Reported-by: Andrei Homescu <[email protected]> Message-Id: <[email protected]> Signed-off-by: Sudeep Holla <[email protected]>
1 parent cecf6a5 commit 3e282f4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/firmware/arm_ffa/driver.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -976,7 +976,7 @@ static void ffa_notification_info_get(void)
976976
}, &ret);
977977

978978
if (ret.a0 != FFA_FN_NATIVE(SUCCESS) && ret.a0 != FFA_SUCCESS) {
979-
if (ret.a2 != FFA_RET_NO_DATA)
979+
if ((s32)ret.a2 != FFA_RET_NO_DATA)
980980
pr_err("Notification Info fetch failed: 0x%lx (0x%lx)",
981981
ret.a0, ret.a2);
982982
return;

0 commit comments

Comments
 (0)