2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2025-01-10 06:34:17 +08:00
linux-next/drivers/media/platform/mediatek
Nícolas F. R. A. Prado dd61c2a380 media: mediatek: vcodec: Consider vdecsys presence in reg range check
Commit fe8a339783 ("media: mediatek: vcodec: Read HW active status
from syscon") allowed the driver to read the VDEC_SYS io space from a
syscon instead of from the reg property when reg-names are supplied.
However as part of that change, a smatch warning was introduced:

drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_drv.c:142 mtk_vcodec_get_reg_bases() error: buffer overflow 'mtk_dec_reg_names' 11 <= 11

With a correct Devicetree, that is, one that follows the dt-binding, it
wouldn't be possible to trigger such a buffer overflow. Even so, update
the range validation of the reg property, so that the smatch warning is
fixed and if an incorrect Devicetree is ever supplied the code errors
out instead of causing memory corruption.

Reported-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Closes: https://lore.kernel.org/all/b5fd2dff-14a5-3ad8-9698-d1a50f4516fa@xs4all.nl
Fixes: fe8a339783 ("media: mediatek: vcodec: Read HW active status from syscon")
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Signed-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2023-07-27 11:24:26 +02:00
..
jpeg media: mtk-jpeg: Fix use after free bug due to uncanceled work 2023-07-25 09:31:48 +02:00
mdp media: Explicitly include correct DT includes 2023-07-19 12:57:51 +02:00
mdp3 media: mdp3: Fix resource leaks in of_find_device_by_node 2023-07-19 12:57:47 +02:00
vcodec media: mediatek: vcodec: Consider vdecsys presence in reg range check 2023-07-27 11:24:26 +02:00
vpu media: Explicitly include correct DT includes 2023-07-19 12:57:51 +02:00
Kconfig media: platform: mtk-mdp3: add MediaTek MDP3 driver 2022-08-30 16:25:51 +02:00
Makefile media: platform: mtk-mdp3: add MediaTek MDP3 driver 2022-08-30 16:25:51 +02:00