android_kernel_motorola_sm6375/drivers/firmware
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Dan Carpenter 50fd584fbb firmware: arm_scpi: Prevent the ternary sign expansion bug
[ Upstream commit d9cd78edb2e6b7e26747c0ec312be31e7ef196fe ]

How the 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.

Fix this by getting rid of the ternary.

Link: https://lore.kernel.org/r/YIE7pdqV/h10tEAK@mwanda
Fixes: 8cb7cf56c9 ("firmware: add support for ARM System Control and Power Interface(SCPI) protocol")
Reviewed-by: Cristian Marussi <[email protected]>
Signed-off-by: Dan Carpenter <[email protected]>
[sudeep.holla: changed to return 0 as clock rate on error]
Signed-off-by: Sudeep Holla <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
2021-05-26 12:05:14 +02:00
..
arm_scmi firmware: arm_scmi: Add missing Rx size re-initialisation 2020-11-05 11:43:12 +01:00
broadcom
efi firmware/efi: Fix a use after bug in efi_mem_reserve_persistent 2021-03-24 11:26:45 +01:00
google
imx firmware: imx: select SOC_BUS to fix firmware build 2021-02-03 23:25:59 +01:00
meson
psci drivers/firmware/psci: Fix memory leakage in alloc_init_cpu_groups() 2020-07-29 10:18:28 +02:00
tegra
xilinx
arm_scpi.c firmware: arm_scpi: Prevent the ternary sign expansion bug 2021-05-26 12:05:14 +02:00
arm_sdei.c firmware: arm_sdei: Use cpus_read_lock() to avoid races with cpuhp 2020-10-01 13:17:37 +02:00
dmi-id.c
dmi-sysfs.c
dmi_scan.c
edd.c
iscsi_ibft.c
iscsi_ibft_find.c
Kconfig firmware: qcom-scm: Fix QCOM_SCM configuration 2021-05-14 09:44:22 +02:00
Makefile
memmap.c
pcdp.c
pcdp.h
qcom_scm-32.c
qcom_scm-64.c
qcom_scm.c firmware: qcom_scm: fix bogous abuse of dma-direct internals 2020-06-24 17:50:21 +02:00
qcom_scm.h
qemu_fw_cfg.c firmware: Fix a reference count leak. 2020-08-11 15:33:38 +02:00
raspberrypi.c
scpi_pm_domain.c
stratix10-rsu.c
stratix10-svc.c
ti_sci.c
ti_sci.h
trusted_foundations.c
turris-mox-rwtm.c