Linux Framebuffer Layer development
 help / color / mirror / Atom feed
* [PATCH] fbcon: Use correct type for vc_resize() return value
@ 2026-05-14  9:19 Jiacheng Yu
  2026-05-15  7:12 ` Thomas Zimmermann
  0 siblings, 1 reply; 2+ messages in thread
From: Jiacheng Yu @ 2026-05-14  9:19 UTC (permalink / raw)
  To: deller, tzimmermann, simona
  Cc: sravankumarlpu, dri-devel, linux-fbdev, linux-kernel,
	liuyongqiang13

The return value of vc_resize() is int, but fbcon_set_disp() stores it
in an unsigned long variable. While the !ret check happens to work
correctly by coincidence (negative values become large positive values),
the types should match. Use int instead.

Eliminates the following W=3 warning:

  drivers/video/fbdev/core/fbcon.c: In function 'fbcon_set_disp':
  drivers/video/fbdev/core/fbcon.c:1494:14: warning: implicit conversion from 'int' to 'unsigned long' [-Wconversion]

Fixes: af0db3c1f898 ("fbdev: Fix vmalloc out-of-bounds write in fast_imageblit")
Signed-off-by: Jiacheng Yu <yujiacheng3@huawei.com>
---
 drivers/video/fbdev/core/fbcon.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c
index b0e3e765360d..641687a734d5 100644
--- a/drivers/video/fbdev/core/fbcon.c
+++ b/drivers/video/fbdev/core/fbcon.c
@@ -1440,8 +1440,7 @@ static void fbcon_set_disp(struct fb_info *info, struct fb_var_screeninfo *var,
 	struct vc_data **default_mode, *vc;
 	struct vc_data *svc;
 	struct fbcon_par *par = info->fbcon_par;
-	int rows, cols;
-	unsigned long ret = 0;
+	int rows, cols, ret;
 
 	p = &fb_display[unit];
 
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] fbcon: Use correct type for vc_resize() return value
  2026-05-14  9:19 [PATCH] fbcon: Use correct type for vc_resize() return value Jiacheng Yu
@ 2026-05-15  7:12 ` Thomas Zimmermann
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Zimmermann @ 2026-05-15  7:12 UTC (permalink / raw)
  To: Jiacheng Yu, deller, simona
  Cc: sravankumarlpu, dri-devel, linux-fbdev, linux-kernel,
	liuyongqiang13



Am 14.05.26 um 11:19 schrieb Jiacheng Yu:
> The return value of vc_resize() is int, but fbcon_set_disp() stores it
> in an unsigned long variable. While the !ret check happens to work
> correctly by coincidence (negative values become large positive values),
> the types should match. Use int instead.
>
> Eliminates the following W=3 warning:
>
>    drivers/video/fbdev/core/fbcon.c: In function 'fbcon_set_disp':
>    drivers/video/fbdev/core/fbcon.c:1494:14: warning: implicit conversion from 'int' to 'unsigned long' [-Wconversion]
>
> Fixes: af0db3c1f898 ("fbdev: Fix vmalloc out-of-bounds write in fast_imageblit")
> Signed-off-by: Jiacheng Yu <yujiacheng3@huawei.com>

Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de>

Thanks for the patch.

> ---
>   drivers/video/fbdev/core/fbcon.c | 3 +--
>   1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c
> index b0e3e765360d..641687a734d5 100644
> --- a/drivers/video/fbdev/core/fbcon.c
> +++ b/drivers/video/fbdev/core/fbcon.c
> @@ -1440,8 +1440,7 @@ static void fbcon_set_disp(struct fb_info *info, struct fb_var_screeninfo *var,
>   	struct vc_data **default_mode, *vc;
>   	struct vc_data *svc;
>   	struct fbcon_par *par = info->fbcon_par;
> -	int rows, cols;
> -	unsigned long ret = 0;
> +	int rows, cols, ret;
>   
>   	p = &fb_display[unit];
>   

-- 
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstr. 146, 90461 Nürnberg, Germany, www.suse.com
GF: Jochen Jaser, Andrew McDonald, Werner Knoblich, (HRB 36809, AG Nürnberg)



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-05-15  7:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-14  9:19 [PATCH] fbcon: Use correct type for vc_resize() return value Jiacheng Yu
2026-05-15  7:12 ` Thomas Zimmermann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox