[PATCH] firmware: arm_scpi: prevent ternary sign expansion bug

Sudeep Holla sudeep.holla at arm.com
Wed Apr 28 11:03:06 BST 2021


On Thu, 22 Apr 2021 12:02:29 +0300, Dan Carpenter wrote:
> How type promotion works in ternary expressions is a bit tricky.
> The problem is that scpi_clk_get_val() returns longs, "ret" is a int
> which holds a negative error code, and le32_to_cpu() is an unsigned int.
> We want the negative error code to be cast to a negative long.  But
> because le32_to_cpu() is an u32 then "ret" is type promoted to u32 and
> becomes a high positive and then it is promoted to long and it is still
> a high positive value.
>
> [...]

Applied to sudeep.holla/linux (for-next/scmi), thanks!

[1/1] firmware: arm_scpi: prevent ternary sign expansion bug
      https://git.kernel.org/sudeep.holla/c/d9cd78edb2

--
Regards,
Sudeep




More information about the linux-arm-kernel mailing list