mirror-linux/include/linux/firmware
Michal Wilczynski 88c4bd9072 firmware: thead: Fix buffer overflow and use standard endian macros
Addresses two issues in the TH1520 AON firmware protocol driver:

1. Fix a potential buffer overflow where the code used unsafe pointer
   arithmetic to access the 'mode' field through the 'resource' pointer
   with an offset. This was flagged by Smatch static checker as:
   "buffer overflow 'data' 2 <= 3"

2. Replace custom RPC_SET_BE* and RPC_GET_BE* macros with standard
   kernel endianness conversion macros (cpu_to_be16, etc.) for better
   portability and maintainability.

The functionality was re-tested with the GPU power-up sequence,
confirming the GPU powers up correctly and the driver probes
successfully.

[   12.702370] powervr ffef400000.gpu: [drm] loaded firmware
powervr/rogue_36.52.104.182_v1.fw
[   12.711043] powervr ffef400000.gpu: [drm] FW version v1.0 (build
6645434 OS)
[   12.719787] [drm] Initialized powervr 1.0.0 for ffef400000.gpu on
minor 0

Fixes: e4b3cbd840 ("firmware: thead: Add AON firmware protocol driver")
Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
Closes: https://lore.kernel.org/all/17a0ccce-060b-4b9d-a3c4-8d5d5823b1c9@stanley.mountain/
Signed-off-by: Michal Wilczynski <m.wilczynski@samsung.com>
Reviewed-by: Dan Carpenter <dan.carpenter@linaro.org>
Acked-by: Drew Fustini <fustini@kernel.org>
Cc: stable@vger.kernel.org
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2026-04-01 13:03:07 +02:00
..
broadcom
cirrus firmware: cs_dsp: mock_bin: Add function to create long-offset patches 2026-01-05 13:18:28 +00:00
imx ASoC: fsl_sai: Add AUDMIX mode support on i.MX952 2026-01-26 12:09:19 +00:00
intel firmware: stratix10-svc: Add Multi SVC clients support 2026-03-10 11:32:31 -05:00
mediatek
meson
qcom firmware: qcom_scm: Add qcom_scm_pas_get_rsc_table() to get resource table 2026-01-13 12:14:34 -06:00
samsung firmware: exynos-acpm: add empty method to allow compile test 2025-10-22 07:49:38 +02:00
thead firmware: thead: Fix buffer overflow and use standard endian macros 2026-04-01 13:03:07 +02:00
trusted_foundations.h
xlnx-event-manager.h
xlnx-zynqmp-crypto.h firmware: xilinx: Add firmware API's to support aes-gcm in Versal device 2026-01-23 13:48:43 +08:00
xlnx-zynqmp-ufs.h scsi: firmware: xilinx: Add APIs for UFS PHY initialization 2025-10-29 23:00:48 -04:00
xlnx-zynqmp.h firmware: zynqmp: Move crypto API's to separate file 2026-01-23 13:48:43 +08:00