drm/simpledrm: Fix return type of simpledrm_simple_display_pipe_mode_valid()
Subsystems (3)
PATCH 1/1 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.
--- drivers/gpu/drm/tiny/simpledrm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/tiny/simpledrm.c +1 -1
@@ -627,7 +627,7 @@ static const struct drm_connector_funcs simpledrm_connector_funcs = { .atomic_destroy_state = drm_atomic_helper_connector_destroy_state, }; -static int +static enum drm_mode_status simpledrm_simple_display_pipe_mode_valid (struct drm_simple_display_pipe *pipe,const struct drm_display_mode *mode) {
base-commit: e0dccc3b76fb35bb257b4118367a883073d7390e
Signature · 1 line
2.37.1
Quoted 34 lines · Nathan Chancellor
When booting a kernel compiled with clang's CFI protection (
CONFIG_CFI_CLANG), there is a CFI failure indrm_simple_kms_crtc_mode_valid()when trying to callsimpledrm_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 'enumdrm_mode_status', not 'int'. Correct it to fix the CFI failure.Fixes 11e8f5fd223b ("drm: Add simpledrm driver")Reported-by Tomasz Paweł Gajc <[email protected]>Signed-off-by Nathan Chancellor <[email protected]>--- drivers/gpu/drm/tiny/simpledrm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/tiny/simpledrm.c +0
-0
drivers/gpu/drm/tiny/simpledrm.c static const struct drm_connector_funcs simpledrm_connector_funcs = { · line 633
Quoted 8 lines
drivers/gpu/drm/tiny/simpledrm.c +1
-1@@ -627,7 +627,7 @@ static const struct drm_connector_funcs simpledrm_connector_funcs = { .atomic_destroy_state = drm_atomic_helper_connector_destroy_state, }; -static int +static enum drm_mode_status simpledrm_simple_display_pipe_mode_valid (struct drm_simple_display_pipe *pipe,const struct drm_display_mode *mode) {
Thanks for fixing this, Nathan! The patch looks correct to me.
Sami
Thomas Zimmermann
maintainerHi
Am 26.07.22 um 02:12 schrieb Sami Tolvanen:
Quoted 46 lines · Nathan Chancellor
Quoted 34 lines
When booting a kernel compiled with clang's CFI protection (
CONFIG_CFI_CLANG), there is a CFI failure indrm_simple_kms_crtc_mode_valid()when trying to callsimpledrm_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 'enumdrm_mode_status', not 'int'. Correct it to fix the CFI failure.Fixes 11e8f5fd223b ("drm: Add simpledrm driver")Reported-by Tomasz Paweł Gajc <[email protected]>Signed-off-by Nathan Chancellor <[email protected]>--- drivers/gpu/drm/tiny/simpledrm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/tiny/simpledrm.c +0
-0drivers/gpu/drm/tiny/simpledrm.c static const struct drm_connector_funcs simpledrm_connector_funcs = { · line 633
Quoted 8 lines
drivers/gpu/drm/tiny/simpledrm.c +1
-1@@ -627,7 +627,7 @@ static const struct drm_connector_funcs simpledrm_connector_funcs = { .atomic_destroy_state = drm_atomic_helper_connector_destroy_state, }; -static int +static enum drm_mode_status simpledrm_simple_display_pipe_mode_valid (struct drm_simple_display_pipe *pipe,const struct drm_display_mode *mode) {Thanks for fixing this, Nathan! The patch looks correct to me.
Quoted 1 line
Reviewed-by Sami Tolvanen <[email protected]>
Thanks a lot. I've added the patch to drm-misc-fixes.
Best regards
Thomas
Quoted 2 lines
Sami
Signature · 6 lines
Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Maxfeldstr. 5, 90409 Nürnberg, Germany (HRB 36809, AG Nürnberg) Geschäftsführer: Ivo Totev