* [PATCH] drm/pixpaper: Fix return type of pixpaper_mode_valid()
@ 2025-09-08 20:24 Nathan Chancellor
2025-09-10 12:13 ` Thomas Zimmermann
0 siblings, 1 reply; 2+ messages in thread
From: Nathan Chancellor @ 2025-09-08 20:24 UTC (permalink / raw)
To: LiangCheng Wang, Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann
Cc: dri-devel, linux-kernel, Nathan Chancellor
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 tiny DRM pixpaper driver:
drivers/gpu/drm/tiny/pixpaper.c:982:16: error: incompatible function pointer types initializing 'enum drm_mode_status (*)(struct drm_crtc *, const struct drm_display_mode *)' with an expression of type 'int (struct drm_crtc *, const struct drm_display_mode *)' [-Werror,-Wincompatible-function-pointer-types-strict]
982 | .mode_valid = pixpaper_mode_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 pixpaper_mode_valid() is called
indirectly.
Update the return type of pixpaper_mode_valid() to be
'enum drm_mode_status' to clear up the warning and kCFI violation.
Fixes: c9e70639f591 ("drm: tiny: Add support for Mayqueen Pixpaper e-ink panel")
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
---
drivers/gpu/drm/tiny/pixpaper.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/tiny/pixpaper.c b/drivers/gpu/drm/tiny/pixpaper.c
index b1379cb5f030..32598fb2fee7 100644
--- a/drivers/gpu/drm/tiny/pixpaper.c
+++ b/drivers/gpu/drm/tiny/pixpaper.c
@@ -968,8 +968,8 @@ static const struct drm_crtc_funcs pixpaper_crtc_funcs = {
.atomic_destroy_state = drm_atomic_helper_crtc_destroy_state,
};
-static int pixpaper_mode_valid(struct drm_crtc *crtc,
- const struct drm_display_mode *mode)
+static enum drm_mode_status
+pixpaper_mode_valid(struct drm_crtc *crtc, const struct drm_display_mode *mode)
{
if (mode->hdisplay == PIXPAPER_WIDTH &&
mode->vdisplay == PIXPAPER_HEIGHT) {
---
base-commit: 490b30fbaca2abbd6afa8bdc7e2df329b5d82412
change-id: 20250908-drm-pixpaper-fix-mode_valid-return-type-4228e531193b
Best regards,
--
Nathan Chancellor <nathan@kernel.org>
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH] drm/pixpaper: Fix return type of pixpaper_mode_valid()
2025-09-08 20:24 [PATCH] drm/pixpaper: Fix return type of pixpaper_mode_valid() Nathan Chancellor
@ 2025-09-10 12:13 ` Thomas Zimmermann
0 siblings, 0 replies; 2+ messages in thread
From: Thomas Zimmermann @ 2025-09-10 12:13 UTC (permalink / raw)
To: Nathan Chancellor, LiangCheng Wang, Maarten Lankhorst, Maxime Ripard
Cc: dri-devel, linux-kernel
Am 08.09.25 um 22:24 schrieb Nathan Chancellor:
> 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 tiny DRM pixpaper driver:
>
> drivers/gpu/drm/tiny/pixpaper.c:982:16: error: incompatible function pointer types initializing 'enum drm_mode_status (*)(struct drm_crtc *, const struct drm_display_mode *)' with an expression of type 'int (struct drm_crtc *, const struct drm_display_mode *)' [-Werror,-Wincompatible-function-pointer-types-strict]
> 982 | .mode_valid = pixpaper_mode_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 pixpaper_mode_valid() is called
> indirectly.
>
> Update the return type of pixpaper_mode_valid() to be
> 'enum drm_mode_status' to clear up the warning and kCFI violation.
>
> Fixes: c9e70639f591 ("drm: tiny: Add support for Mayqueen Pixpaper e-ink panel")
> Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de>
Thanks for the fix.
> ---
> drivers/gpu/drm/tiny/pixpaper.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/tiny/pixpaper.c b/drivers/gpu/drm/tiny/pixpaper.c
> index b1379cb5f030..32598fb2fee7 100644
> --- a/drivers/gpu/drm/tiny/pixpaper.c
> +++ b/drivers/gpu/drm/tiny/pixpaper.c
> @@ -968,8 +968,8 @@ static const struct drm_crtc_funcs pixpaper_crtc_funcs = {
> .atomic_destroy_state = drm_atomic_helper_crtc_destroy_state,
> };
>
> -static int pixpaper_mode_valid(struct drm_crtc *crtc,
> - const struct drm_display_mode *mode)
> +static enum drm_mode_status
> +pixpaper_mode_valid(struct drm_crtc *crtc, const struct drm_display_mode *mode)
> {
> if (mode->hdisplay == PIXPAPER_WIDTH &&
> mode->vdisplay == PIXPAPER_HEIGHT) {
>
> ---
> base-commit: 490b30fbaca2abbd6afa8bdc7e2df329b5d82412
> change-id: 20250908-drm-pixpaper-fix-mode_valid-return-type-4228e531193b
>
> Best regards,
> --
> Nathan Chancellor <nathan@kernel.org>
>
--
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstrasse 146, 90461 Nuernberg, Germany
GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman
HRB 36809 (AG Nuernberg)
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-09-10 12:13 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-09-08 20:24 [PATCH] drm/pixpaper: Fix return type of pixpaper_mode_valid() Nathan Chancellor
2025-09-10 12:13 ` Thomas Zimmermann
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®