Skip to content

Commit 0c09bc3

Browse files
nathanchanceThomas Zimmermann
authored andcommitted
drm/simpledrm: Fix return type of simpledrm_simple_display_pipe_mode_valid()
When booting a kernel compiled with clang's CFI protection (CONFIG_CFI_CLANG), there is a CFI failure in drm_simple_kms_crtc_mode_valid() when trying to call simpledrm_simple_display_pipe_mode_valid() through ->mode_valid(): [ 0.322802] CFI failure (target: simpledrm_simple_display_pipe_mode_valid+0x0/0x8): ... [ 0.324928] Call trace: [ 0.324969] __ubsan_handle_cfi_check_fail+0x58/0x60 [ 0.325053] __cfi_check_fail+0x3c/0x44 [ 0.325120] __cfi_slowpath_diag+0x178/0x200 [ 0.325192] drm_simple_kms_crtc_mode_valid+0x58/0x80 [ 0.325279] __drm_helper_update_and_validate+0x31c/0x464 ... The ->mode_valid() member in 'struct drm_simple_display_pipe_funcs' expects a return type of 'enum drm_mode_status', not 'int'. Correct it to fix the CFI failure. Cc: [email protected] Fixes: 11e8f5f ("drm: Add simpledrm driver") Link: ClangBuiltLinux/linux#1647 Reported-by: Tomasz Paweł Gajc <[email protected]> Signed-off-by: Nathan Chancellor <[email protected]> Signed-off-by: Thomas Zimmermann <[email protected]> Reviewed-by: Sami Tolvanen <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent 02c87df commit 0c09bc3

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/gpu/drm/tiny/simpledrm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -627,7 +627,7 @@ static const struct drm_connector_funcs simpledrm_connector_funcs = {
627627
.atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
628628
};
629629

630-
static int
630+
static enum drm_mode_status
631631
simpledrm_simple_display_pipe_mode_valid(struct drm_simple_display_pipe *pipe,
632632
const struct drm_display_mode *mode)
633633
{

0 commit comments

Comments
 (0)