Skip to contentSkip to conversation

drm: msm: Fix return type of dsi_mgr_connector_mode_valid for kCFI

PATCH In review John Stultz 3 participants 3 messages Jan 29, 2020 – Jan 31, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm: msm: Fix return type of dsi_mgr_connector_mode_valid for kCFI

I was hitting kCFI crashes when building with clang, and after some digging finally narrowed it down to the dsi_mgr_connector_mode_valid() function being implemented as returning an int, instead of an enum drm_mode_status.

This patch fixes it, and appeases the opaque word of the kCFI gods (seriously, clang inlining everything makes the kCFI backtraces only really rough estimates of where things went wrong).

Thanks as always to Sami for his help narrowing this down.

Cc Rob Clark <[email protected]>
Cc Sean Paul <[email protected]>
Cc Sami Tolvanen <[email protected]>
Cc Todd Kjos <[email protected]>
Cc Alistair Delva <[email protected]>
Cc Amit Pundir <[email protected]>
Cc Sumit Semwal <[email protected]>
---
 drivers/gpu/drm/msm/dsi/dsi_manager.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/msm/dsi/dsi_manager.c +1 -1
index 271aa7bbca925..355a60b4a536f 100644
@@ -336,7 +336,7 @@ static int dsi_mgr_connector_get_modes(struct drm_connector *connector)
 	return num;
 }
 
-static int dsi_mgr_connector_mode_valid(struct drm_connector *connector,
+static enum drm_mode_status dsi_mgr_connector_mode_valid(struct drm_connector *connector,
 				struct drm_display_mode *mode)
 {
 	int id = dsi_mgr_connector_get_id(connector);
Signature · 1 line
2.17.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 13 lines · John Stultz

I was hitting kCFI crashes when building with clang, and after some digging finally narrowed it down to the dsi_mgr_connector_mode_valid() function being implemented as returning an int, instead of an enum drm_mode_status.

This patch fixes it, and appeases the opaque word of the kCFI gods (seriously, clang inlining everything makes the kCFI backtraces only really rough estimates of where things went wrong).

Thanks as always to Sami for his help narrowing this down.

Quoted 10 lines
Cc Rob Clark <[email protected]>
Cc Sean Paul <[email protected]>
Cc Sami Tolvanen <[email protected]>
Cc Todd Kjos <[email protected]>
Cc Alistair Delva <[email protected]>
Cc Amit Pundir <[email protected]>
Cc Sumit Semwal <[email protected]>

John, thanks for fixing this. Our inliner is a point of pride (inlining indirect function calls; you're welcome). ;) Indeed, the function pointer member mode_valid in struct drm_connector_helper_funcs in include/drm/drm_modeset_helper_vtables.h returns an enum drm_mode_status.

Quoted 18 lines
---
 drivers/gpu/drm/msm/dsi/dsi_manager.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/msm/dsi/dsi_manager.c +1 -2
index 271aa7bbca925..355a60b4a536f 100644
@@ -336,7 +336,7 @@ static int dsi_mgr_connector_get_modes(struct drm_connector *connector)
        return num;
 }
 
-static int dsi_mgr_connector_mode_valid(struct drm_connector *connector,
+static enum drm_mode_status dsi_mgr_connector_mode_valid(struct drm_connector *connector,
                                struct drm_display_mode *mode)
 {
        int id = dsi_mgr_connector_get_id(connector);
--
Signature · 2 lines
Thanks,
~Nick Desaulniers
Tested-by on v1 1/1
#2 lore raw
In reply to John Stultz
Quoted 13 lines · John Stultz

I was hitting kCFI crashes when building with clang, and after some digging finally narrowed it down to the dsi_mgr_connector_mode_valid() function being implemented as returning an int, instead of an enum drm_mode_status.

This patch fixes it, and appeases the opaque word of the kCFI gods (seriously, clang inlining everything makes the kCFI backtraces only really rough estimates of where things went wrong).

Thanks as always to Sami for his help narrowing this down.

Quoted 10 lines
Cc Rob Clark <[email protected]>
Cc Sean Paul <[email protected]>
Cc Sami Tolvanen <[email protected]>
Cc Todd Kjos <[email protected]>
Cc Alistair Delva <[email protected]>
Cc Amit Pundir <[email protected]>
Cc Sumit Semwal <[email protected]>
Quoted 20 lines
---
 drivers/gpu/drm/msm/dsi/dsi_manager.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/msm/dsi/dsi_manager.c +1 -2
index 271aa7bbca925..355a60b4a536f 100644
@@ -336,7 +336,7 @@ static int dsi_mgr_connector_get_modes(struct drm_connector *connector)
        return num;
 }
 
-static int dsi_mgr_connector_mode_valid(struct drm_connector *connector,
+static enum drm_mode_status dsi_mgr_connector_mode_valid(struct drm_connector *connector,
                                struct drm_display_mode *mode)
 {
        int id = dsi_mgr_connector_get_id(connector);
--

2.17.1