All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Nathan Chancellor <nathan@kernel.org>,
	Sami Tolvanen <samitolvanen@google.com>,
	Kees Cook <keescook@chromium.org>,
	AngeloGioacchino Del Regno
	<angelogioacchino.delregno@collabora.com>,
	Chun-Kuang Hu <chunkuang.hu@kernel.org>,
	Sasha Levin <sashal@kernel.org>,
	p.zabel@pengutronix.de, airlied@gmail.com, daniel@ffwll.ch,
	matthias.bgg@gmail.com, ndesaulniers@google.com,
	dri-devel@lists.freedesktop.org,
	linux-mediatek@lists.infradead.org,
	linux-arm-kernel@lists.infradead.org, llvm@lists.linux.dev
Subject: [PATCH AUTOSEL 5.15 24/46] drm/mediatek: Fix return type of mtk_hdmi_bridge_mode_valid()
Date: Sun, 18 Dec 2022 11:12:22 -0500	[thread overview]
Message-ID: <20221218161244.930785-24-sashal@kernel.org> (raw)
In-Reply-To: <20221218161244.930785-1-sashal@kernel.org>

From: Nathan Chancellor <nathan@kernel.org>

[ Upstream commit 890d637523eec9d730e3885532fa1228ba678880 ]

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>
---
 drivers/gpu/drm/mediatek/mtk_hdmi.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/mediatek/mtk_hdmi.c b/drivers/gpu/drm/mediatek/mtk_hdmi.c
index 3196189429bc..7613b0fa2be6 100644
--- a/drivers/gpu/drm/mediatek/mtk_hdmi.c
+++ b/drivers/gpu/drm/mediatek/mtk_hdmi.c
@@ -1203,9 +1203,10 @@ static enum drm_connector_status mtk_hdmi_detect(struct mtk_hdmi *hdmi)
 	return mtk_hdmi_update_plugged_status(hdmi);
 }
 
-static int mtk_hdmi_bridge_mode_valid(struct drm_bridge *bridge,
-				      const struct drm_display_info *info,
-				      const struct drm_display_mode *mode)
+static enum drm_mode_status
+mtk_hdmi_bridge_mode_valid(struct drm_bridge *bridge,
+			   const struct drm_display_info *info,
+			   const struct drm_display_mode *mode)
 {
 	struct mtk_hdmi *hdmi = hdmi_ctx_from_bridge(bridge);
 	struct drm_bridge *next_bridge;
-- 
2.35.1


WARNING: multiple messages have this Message-ID (diff)
From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Sasha Levin <sashal@kernel.org>,
	Chun-Kuang Hu <chunkuang.hu@kernel.org>,
	Kees Cook <keescook@chromium.org>,
	llvm@lists.linux.dev, ndesaulniers@google.com,
	dri-devel@lists.freedesktop.org,
	Nathan Chancellor <nathan@kernel.org>,
	linux-mediatek@lists.infradead.org,
	Sami Tolvanen <samitolvanen@google.com>,
	matthias.bgg@gmail.com, linux-arm-kernel@lists.infradead.org,
	AngeloGioacchino Del Regno
	<angelogioacchino.delregno@collabora.com>
Subject: [PATCH AUTOSEL 5.15 24/46] drm/mediatek: Fix return type of mtk_hdmi_bridge_mode_valid()
Date: Sun, 18 Dec 2022 11:12:22 -0500	[thread overview]
Message-ID: <20221218161244.930785-24-sashal@kernel.org> (raw)
In-Reply-To: <20221218161244.930785-1-sashal@kernel.org>

From: Nathan Chancellor <nathan@kernel.org>

[ Upstream commit 890d637523eec9d730e3885532fa1228ba678880 ]

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>
---
 drivers/gpu/drm/mediatek/mtk_hdmi.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/mediatek/mtk_hdmi.c b/drivers/gpu/drm/mediatek/mtk_hdmi.c
index 3196189429bc..7613b0fa2be6 100644
--- a/drivers/gpu/drm/mediatek/mtk_hdmi.c
+++ b/drivers/gpu/drm/mediatek/mtk_hdmi.c
@@ -1203,9 +1203,10 @@ static enum drm_connector_status mtk_hdmi_detect(struct mtk_hdmi *hdmi)
 	return mtk_hdmi_update_plugged_status(hdmi);
 }
 
-static int mtk_hdmi_bridge_mode_valid(struct drm_bridge *bridge,
-				      const struct drm_display_info *info,
-				      const struct drm_display_mode *mode)
+static enum drm_mode_status
+mtk_hdmi_bridge_mode_valid(struct drm_bridge *bridge,
+			   const struct drm_display_info *info,
+			   const struct drm_display_mode *mode)
 {
 	struct mtk_hdmi *hdmi = hdmi_ctx_from_bridge(bridge);
 	struct drm_bridge *next_bridge;
-- 
2.35.1


WARNING: multiple messages have this Message-ID (diff)
From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Nathan Chancellor <nathan@kernel.org>,
	Sami Tolvanen <samitolvanen@google.com>,
	Kees Cook <keescook@chromium.org>,
	AngeloGioacchino Del Regno
	<angelogioacchino.delregno@collabora.com>,
	Chun-Kuang Hu <chunkuang.hu@kernel.org>,
	Sasha Levin <sashal@kernel.org>,
	p.zabel@pengutronix.de, airlied@gmail.com, daniel@ffwll.ch,
	matthias.bgg@gmail.com, ndesaulniers@google.com,
	dri-devel@lists.freedesktop.org,
	linux-mediatek@lists.infradead.org,
	linux-arm-kernel@lists.infradead.org, llvm@lists.linux.dev
Subject: [PATCH AUTOSEL 5.15 24/46] drm/mediatek: Fix return type of mtk_hdmi_bridge_mode_valid()
Date: Sun, 18 Dec 2022 11:12:22 -0500	[thread overview]
Message-ID: <20221218161244.930785-24-sashal@kernel.org> (raw)
In-Reply-To: <20221218161244.930785-1-sashal@kernel.org>

From: Nathan Chancellor <nathan@kernel.org>

[ Upstream commit 890d637523eec9d730e3885532fa1228ba678880 ]

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>
---
 drivers/gpu/drm/mediatek/mtk_hdmi.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/mediatek/mtk_hdmi.c b/drivers/gpu/drm/mediatek/mtk_hdmi.c
index 3196189429bc..7613b0fa2be6 100644
--- a/drivers/gpu/drm/mediatek/mtk_hdmi.c
+++ b/drivers/gpu/drm/mediatek/mtk_hdmi.c
@@ -1203,9 +1203,10 @@ static enum drm_connector_status mtk_hdmi_detect(struct mtk_hdmi *hdmi)
 	return mtk_hdmi_update_plugged_status(hdmi);
 }
 
-static int mtk_hdmi_bridge_mode_valid(struct drm_bridge *bridge,
-				      const struct drm_display_info *info,
-				      const struct drm_display_mode *mode)
+static enum drm_mode_status
+mtk_hdmi_bridge_mode_valid(struct drm_bridge *bridge,
+			   const struct drm_display_info *info,
+			   const struct drm_display_mode *mode)
 {
 	struct mtk_hdmi *hdmi = hdmi_ctx_from_bridge(bridge);
 	struct drm_bridge *next_bridge;
-- 
2.35.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  parent reply	other threads:[~2022-12-18 16:14 UTC|newest]

Thread overview: 72+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-18 16:11 [PATCH AUTOSEL 5.15 01/46] drm/etnaviv: add missing quirks for GC300 Sasha Levin
2022-12-18 16:11 ` Sasha Levin
2022-12-18 16:12 ` [PATCH AUTOSEL 5.15 02/46] media: imx-jpeg: Disable useless interrupt to avoid kernel panic Sasha Levin
2022-12-18 16:12   ` Sasha Levin
2022-12-18 16:12 ` [PATCH AUTOSEL 5.15 03/46] brcmfmac: return error when getting invalid max_flowrings from dongle Sasha Levin
2022-12-18 16:12 ` [PATCH AUTOSEL 5.15 04/46] wifi: ath9k: verify the expected usb_endpoints are present Sasha Levin
2022-12-18 16:12 ` [PATCH AUTOSEL 5.15 05/46] wifi: ar5523: Fix use-after-free on ar5523_cmd() timed out Sasha Levin
2022-12-18 16:12 ` [PATCH AUTOSEL 5.15 06/46] ASoC: codecs: rt298: Add quirk for KBL-R RVP platform Sasha Levin
2022-12-18 16:12   ` Sasha Levin
2022-12-18 16:12 ` [PATCH AUTOSEL 5.15 07/46] ipmi: fix memleak when unload ipmi driver Sasha Levin
2022-12-18 16:12 ` [PATCH AUTOSEL 5.15 08/46] drm/amd/display: prevent memory leak Sasha Levin
2022-12-18 16:12   ` Sasha Levin
2022-12-18 16:12   ` Sasha Levin
2022-12-18 16:12 ` [PATCH AUTOSEL 5.15 09/46] Revert "drm/amd/display: Limit max DSC target bpp for specific monitors" Sasha Levin
2022-12-18 16:12   ` Sasha Levin
2022-12-18 16:12   ` Sasha Levin
2022-12-18 16:12 ` [PATCH AUTOSEL 5.15 10/46] qed (gcc13): use u16 for fid to be big enough Sasha Levin
2022-12-18 16:12 ` [PATCH AUTOSEL 5.15 11/46] bpf: make sure skb->len != 0 when redirecting to a tunneling device Sasha Levin
2022-12-18 16:12 ` [PATCH AUTOSEL 5.15 12/46] net: ethernet: ti: Fix return type of netcp_ndo_start_xmit() Sasha Levin
2022-12-18 16:12 ` [PATCH AUTOSEL 5.15 13/46] hamradio: baycom_epp: Fix return type of baycom_send_packet() Sasha Levin
2022-12-18 16:12 ` [PATCH AUTOSEL 5.15 14/46] wifi: brcmfmac: Fix potential shift-out-of-bounds in brcmf_fw_alloc_request() Sasha Levin
2022-12-18 16:12 ` [Intel-wired-lan] [PATCH AUTOSEL 5.15 15/46] igb: Do not free q_vector unless new one was allocated Sasha Levin
2022-12-18 16:12   ` Sasha Levin
2022-12-18 16:12 ` [PATCH AUTOSEL 5.15 16/46] drm/amdgpu: Fix type of second parameter in trans_msg() callback Sasha Levin
2022-12-18 16:12   ` Sasha Levin
2022-12-18 16:12   ` Sasha Levin
2022-12-18 16:12 ` [PATCH AUTOSEL 5.15 17/46] drm/amdgpu: Fix type of second parameter in odn_edit_dpm_table() callback Sasha Levin
2022-12-18 16:12   ` Sasha Levin
2022-12-18 16:12   ` Sasha Levin
2022-12-18 16:12 ` [PATCH AUTOSEL 5.15 18/46] s390/ctcm: Fix return type of ctc{mp,}m_tx() Sasha Levin
2022-12-18 16:12 ` [PATCH AUTOSEL 5.15 19/46] s390/netiucv: Fix return type of netiucv_tx() Sasha Levin
2022-12-18 16:12 ` [PATCH AUTOSEL 5.15 20/46] s390/lcs: Fix return type of lcs_start_xmit() Sasha Levin
2022-12-18 16:12 ` [PATCH AUTOSEL 5.15 21/46] drm/msm: Use drm_mode_copy() Sasha Levin
2022-12-18 16:12   ` Sasha Levin
2022-12-18 16:12 ` [PATCH AUTOSEL 5.15 22/46] drm/rockchip: " Sasha Levin
2022-12-18 16:12   ` Sasha Levin
2022-12-18 16:12   ` Sasha Levin
2022-12-18 16:12   ` Sasha Levin
2022-12-18 16:12 ` [PATCH AUTOSEL 5.15 23/46] drm/sti: " Sasha Levin
2022-12-18 16:12   ` Sasha Levin
2022-12-18 16:12 ` Sasha Levin [this message]
2022-12-18 16:12   ` [PATCH AUTOSEL 5.15 24/46] drm/mediatek: Fix return type of mtk_hdmi_bridge_mode_valid() Sasha Levin
2022-12-18 16:12   ` Sasha Levin
2022-12-18 16:12 ` [PATCH AUTOSEL 5.15 25/46] drivers/md/md-bitmap: check the return value of md_bitmap_get_counter() Sasha Levin
2022-12-18 16:12 ` [PATCH AUTOSEL 5.15 26/46] md/raid1: stop mdx_raid1 thread when raid1 array run failed Sasha Levin
2022-12-18 16:12 ` [PATCH AUTOSEL 5.15 27/46] drm/amd/display: fix array index out of bound error in bios parser Sasha Levin
2022-12-18 16:12   ` Sasha Levin
2022-12-18 16:12   ` Sasha Levin
2022-12-18 16:12 ` [PATCH AUTOSEL 5.15 28/46] net: add atomic_long_t to net_device_stats fields Sasha Levin
2022-12-18 16:12 ` [PATCH AUTOSEL 5.15 29/46] ipv6/sit: use DEV_STATS_INC() to avoid data-races Sasha Levin
2022-12-18 16:12 ` [PATCH AUTOSEL 5.15 30/46] mrp: introduce active flags to prevent UAF when applicant uninit Sasha Levin
2022-12-18 16:12 ` [PATCH AUTOSEL 5.15 31/46] ppp: associate skb with a device at tx Sasha Levin
2022-12-18 16:12 ` [PATCH AUTOSEL 5.15 32/46] bpf: Prevent decl_tag from being referenced in func_proto arg Sasha Levin
2022-12-18 16:12 ` [PATCH AUTOSEL 5.15 33/46] ethtool: avoiding integer overflow in ethtool_phys_id() Sasha Levin
2022-12-18 16:12 ` [PATCH AUTOSEL 5.15 34/46] media: dvb-frontends: fix leak of memory fw Sasha Levin
2022-12-18 16:12 ` [PATCH AUTOSEL 5.15 35/46] media: dvbdev: adopts refcnt to avoid UAF Sasha Levin
2022-12-18 16:12 ` [PATCH AUTOSEL 5.15 36/46] media: dvb-usb: fix memory leak in dvb_usb_adapter_init() Sasha Levin
2022-12-18 16:12 ` [PATCH AUTOSEL 5.15 37/46] blk-mq: fix possible memleak when register 'hctx' failed Sasha Levin
2022-12-18 16:12 ` [PATCH AUTOSEL 5.15 38/46] drm/amd/display: Use the largest vready_offset in pipe group Sasha Levin
2022-12-18 16:12   ` Sasha Levin
2022-12-18 16:12   ` Sasha Levin
2022-12-18 16:12 ` [PATCH AUTOSEL 5.15 39/46] libbpf: Avoid enum forward-declarations in public API in C++ mode Sasha Levin
2022-12-18 16:12 ` [PATCH AUTOSEL 5.15 40/46] regulator: core: fix use_count leakage when handling boot-on Sasha Levin
2022-12-18 16:12 ` [PATCH AUTOSEL 5.15 41/46] net: dpaa2: publish MAC stringset to ethtool -S even if MAC is missing Sasha Levin
2022-12-19 11:54   ` Vladimir Oltean
2022-12-24  0:29     ` Sasha Levin
2022-12-18 16:12 ` [PATCH AUTOSEL 5.15 42/46] wifi: mt76: do not run mt76u_status_worker if the device is not running Sasha Levin
2022-12-18 16:12   ` Sasha Levin
2022-12-18 16:12 ` [PATCH AUTOSEL 5.15 43/46] mmc: f-sdh30: Add quirks for broken timeout clock capability Sasha Levin
2022-12-18 16:12 ` [PATCH AUTOSEL 5.15 44/46] mmc: renesas_sdhi: better reset from HS400 mode Sasha Levin
2022-12-18 16:12 ` [PATCH AUTOSEL 5.15 45/46] media: si470x: Fix use-after-free in si470x_int_in_callback() Sasha Levin
2022-12-18 16:12 ` [PATCH AUTOSEL 5.15 46/46] clk: st: Fix memory leak in st_of_quadfs_setup() Sasha Levin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221218161244.930785-24-sashal@kernel.org \
    --to=sashal@kernel.org \
    --cc=airlied@gmail.com \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=chunkuang.hu@kernel.org \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=keescook@chromium.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=llvm@lists.linux.dev \
    --cc=matthias.bgg@gmail.com \
    --cc=nathan@kernel.org \
    --cc=ndesaulniers@google.com \
    --cc=p.zabel@pengutronix.de \
    --cc=samitolvanen@google.com \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.