[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAAOTY_-hGe-yWK-iSXDefEPJN9bc8A_r=kNirBAyHgCPhqoAvw@mail.gmail.com>
Date: Tue, 30 Dec 2025 15:50:13 +0000
From: Chun-Kuang Hu <chunkuang.hu@...nel.org>
To: Nathan Chancellor <nathan@...nel.org>
Cc: Chun-Kuang Hu <chunkuang.hu@...nel.org>, Philipp Zabel <p.zabel@...gutronix.de>,
David Airlie <airlied@...il.com>, Matthias Brugger <matthias.bgg@...il.com>,
AngeloGioacchino Del Regno <angelogioacchino.delregno@...labora.com>,
Louis-Alexis Eyraud <louisalexis.eyraud@...labora.com>, CK Hu <ck.hu@...iatek.com>,
dri-devel@...ts.freedesktop.org, linux-mediatek@...ts.infradead.org,
linux-arm-kernel@...ts.infradead.org, llvm@...ts.linux.dev,
patches@...ts.linux.dev, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] drm/mediatek: mtk_hdmi_v2: Fix return type of mtk_hdmi_v2_tmds_char_rate_valid()
Hi, Nathan:
Nathan Chancellor <nathan@...nel.org> 於 2025年11月25日週二 下午10:14寫道:
>
> When building with -Wincompatible-function-pointer-types-strict, a
> warning designed to catch kernel control flow integrity (kCFI) issues at
> build time, there is an instance in the new HDMI v2 drm/mediatek code:
>
> drivers/gpu/drm/mediatek/mtk_hdmi_v2.c:1331:31: error: incompatible function pointer types initializing 'enum drm_mode_status (*)(const struct drm_bridge *, const struct drm_display_mode *, unsigned long long)' with an expression of type 'int (const struct drm_bridge *, const struct drm_display_mode *, unsigned long long)' [-Werror,-Wincompatible-function-pointer-types-strict]
> 1331 | .hdmi_tmds_char_rate_valid = mtk_hdmi_v2_hdmi_tmds_char_rate_valid,
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> While 'int' and 'enum drm_mode_status' are ABI compatible, hence no
> regular warning from -Wincompatible-function-pointer-types, the mismatch
> will trigger a kCFI violation when mtk_hdmi_v2_tmds_char_rate_valid() is
> called indirectly.
>
> Update the return type of mtk_hdmi_v2_tmds_char_rate_valid() to be 'enum
> drm_mode_status' to clear up the warning and kCFI violation.
Applied to mediatek-drm-fixes [1], thanks.
[1] https://git.kernel.org/pub/scm/linux/kernel/git/chunkuang.hu/linux.git/log/?h=mediatek-drm-fixes
Regards,
Chun-Kuang.
>
> Fixes: 8d0f79886273 ("drm/mediatek: Introduce HDMI/DDC v2 for MT8195/MT8188")
> Signed-off-by: Nathan Chancellor <nathan@...nel.org>
> ---
> drivers/gpu/drm/mediatek/mtk_hdmi_v2.c | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/mediatek/mtk_hdmi_v2.c b/drivers/gpu/drm/mediatek/mtk_hdmi_v2.c
> index c272e1e74b7d..454b8b93b834 100644
> --- a/drivers/gpu/drm/mediatek/mtk_hdmi_v2.c
> +++ b/drivers/gpu/drm/mediatek/mtk_hdmi_v2.c
> @@ -1120,9 +1120,10 @@ static void mtk_hdmi_v2_hpd_disable(struct drm_bridge *bridge)
> mtk_hdmi_v2_disable(hdmi);
> }
>
> -static int mtk_hdmi_v2_hdmi_tmds_char_rate_valid(const struct drm_bridge *bridge,
> - const struct drm_display_mode *mode,
> - unsigned long long tmds_rate)
> +static enum drm_mode_status
> +mtk_hdmi_v2_hdmi_tmds_char_rate_valid(const struct drm_bridge *bridge,
> + const struct drm_display_mode *mode,
> + unsigned long long tmds_rate)
> {
> if (mode->clock < MTK_HDMI_V2_CLOCK_MIN)
> return MODE_CLOCK_LOW;
>
> ---
> base-commit: a846505a193d7492ad3531e33cacfca31e4bcdd1
> change-id: 20251125-drm-mediatek-hdmi-v2-wifpts-d67b55175609
>
> Best regards,
> --
> Nathan Chancellor <nathan@...nel.org>
>
Powered by blists - more mailing lists