mirror-linux/drivers/gpu/drm/mediatek
Nathan Chancellor 302c0a8ed3 drm/mediatek: Fix return type of mtk_hdmi_bridge_mode_valid()
[ Upstream commit 890d637523 ]

With clang's kernel control flow integrity (kCFI, CONFIG_CFI_CLANG),
indirect call targets are validated against the expected function
pointer prototype to make sure the call target is valid to help mitigate
ROP attacks. If they are not identical, there is a failure at run time,
which manifests as either a kernel panic or thread getting killed. A
proposed warning in clang aims to catch these at compile time, which
reveals:

  drivers/gpu/drm/mediatek/mtk_hdmi.c:1407:16: error: incompatible function pointer types initializing 'enum drm_mode_status (*)(struct drm_bridge *, const struct drm_display_info *, const struct drm_display_mode *)' with an expression of type 'int (struct drm_bridge *, const struct drm_display_info *, const struct drm_display_mode *)' [-Werror,-Wincompatible-function-pointer-types-strict]
          .mode_valid = mtk_hdmi_bridge_mode_valid,
                        ^~~~~~~~~~~~~~~~~~~~~~~~~~
  1 error generated.

->mode_valid() in 'struct drm_bridge_funcs' expects a return type of
'enum drm_mode_status', not 'int'. Adjust the return type of
mtk_hdmi_bridge_mode_valid() to match the prototype's to resolve the
warning and CFI failure.

Link: https://github.com/ClangBuiltLinux/linux/issues/1750
Reported-by: Sami Tolvanen <samitolvanen@google.com>
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Reviewed-by: Kees Cook <keescook@chromium.org>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2022-12-31 13:33:01 +01:00
..
Kconfig drm/mediatek: Add MT8195 Embedded DisplayPort driver 2022-09-04 15:32:05 +03:00
Makefile drm/mediatek: Add MT8195 Embedded DisplayPort driver 2022-09-04 15:32:05 +03:00
mtk_cec.c
mtk_cec.h
mtk_disp_aal.c
mtk_disp_ccorr.c
mtk_disp_color.c
mtk_disp_drv.h drm/mediatek: Add display merge start/stop API for cmdq support 2022-06-27 22:32:28 +08:00
mtk_disp_gamma.c
mtk_disp_merge.c drm/mediatek: Add display merge async reset control 2022-06-27 22:39:37 +08:00
mtk_disp_ovl.c drm: Drop drm_blend.h from drm_crtc.h 2022-06-20 23:53:55 +03:00
mtk_disp_rdma.c Mediatek DRM Next for Linux 5.20 2022-07-12 17:01:42 +10:00
mtk_dp.c drm/mediatek: dp: change mtk_dp_driver to static 2022-09-19 12:33:54 +03:00
mtk_dp_reg.h drm/mediatek: dp: Remove unused register definitions 2022-09-19 12:17:42 +03:00
mtk_dpi.c drm/mediatek: Modify dpi power on/off sequence. 2022-12-31 13:32:11 +01:00
mtk_dpi_regs.h drm/mediatek: dpi: Add dp_intf support 2022-07-06 22:51:44 +08:00
mtk_drm_crtc.c drm: Remove unnecessary include statements of drm_plane_helper.h 2022-07-26 18:42:04 +02:00
mtk_drm_crtc.h
mtk_drm_ddp_comp.c drm/mediatek: Fix wrong dither settings 2022-09-13 07:10:08 +08:00
mtk_drm_ddp_comp.h drm/mediatek: dpi: Add dp_intf support 2022-07-06 22:51:44 +08:00
mtk_drm_drv.c Mediatek DRM Next for Linux 6.1 2022-09-28 07:05:45 +10:00
mtk_drm_drv.h drm/mediatek: Add display MDP RDMA support for MT8195 2022-06-27 22:24:14 +08:00
mtk_drm_gem.c drm/gem: rename GEM CMA helpers to GEM DMA helpers 2022-08-03 18:31:49 +02:00
mtk_drm_gem.h
mtk_drm_plane.c drm/atomic-helper: Remove _HELPER_ infix from DRM_PLANE_HELPER_NO_SCALING 2022-07-26 18:42:00 +02:00
mtk_drm_plane.h drm/mediatek: Add mediatek-drm plane color encoding info 2022-06-27 22:42:20 +08:00
mtk_dsi.c drm/mediatek: dsi: Move mtk_dsi_stop() call back to mtk_dsi_poweroff() 2022-09-22 07:31:43 +08:00
mtk_hdmi.c drm/mediatek: Fix return type of mtk_hdmi_bridge_mode_valid() 2022-12-31 13:33:01 +01:00
mtk_hdmi.h
mtk_hdmi_ddc.c
mtk_hdmi_regs.h
mtk_mdp_rdma.c drm/mediatek: Add display MDP RDMA support for MT8195 2022-06-27 22:24:14 +08:00
mtk_mdp_rdma.h drm/mediatek: Add display MDP RDMA support for MT8195 2022-06-27 22:24:14 +08:00