* [PATCH] fbcon: Use correct type for vc_resize() return value
@ 2026-05-14 9:19 Jiacheng Yu
2026-05-15 7:12 ` Thomas Zimmermann
` (2 more replies)
0 siblings, 3 replies; 4+ 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] 4+ 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
2026-05-16 1:04 ` Claude review: " Claude Code Review Bot
2026-05-16 1:04 ` Claude Code Review Bot
2 siblings, 0 replies; 4+ 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] 4+ messages in thread* Claude review: 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
@ 2026-05-16 1:04 ` Claude Code Review Bot
2026-05-16 1:04 ` Claude Code Review Bot
2 siblings, 0 replies; 4+ messages in thread
From: Claude Code Review Bot @ 2026-05-16 1:04 UTC (permalink / raw)
To: dri-devel-reviews
Patch Review
**Assessment: Correct and clean.**
The change is straightforward:
```c
- int rows, cols;
- unsigned long ret = 0;
+ int rows, cols, ret;
```
This is the right fix. `vc_resize()` is declared in `include/linux/vt_kern.h:46` as returning `int`, so `ret` should be `int`. The usage at line 1494-1496 is:
```c
ret = vc_resize(vc, cols, rows);
if (con_is_visible(vc) && !ret)
update_screen(vc);
```
The `!ret` check works identically for both types when the value comes from `vc_resize()`, so this is purely a type-correctness fix with no behavioral change. The `= 0` initializer is correctly dropped since `ret` is always assigned before use (at line 1494), and every path that reaches line 1494 will set it.
**Minor nit on the Fixes tag:** The commit message claims `Fixes: af0db3c1f898 ("fbdev: Fix vmalloc out-of-bounds write in fast_imageblit")`. That commit title is about `fast_imageblit`, which seems unrelated to the `unsigned long ret` declaration in `fbcon_set_disp()`. I'd recommend the author double-check that the Fixes tag points to the correct commit — it should point to whichever commit introduced the `unsigned long ret` variable in this function. If it was always `unsigned long` since the function's inception, a Fixes tag may not be appropriate at all (a simple cleanup doesn't necessarily need one).
**No other issues.** The patch is minimal, correctly scoped, and the commit message accurately describes the warning being fixed.
---
Generated by Claude Code Patch Reviewer
^ permalink raw reply [flat|nested] 4+ messages in thread* Claude review: 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
2026-05-16 1:04 ` Claude review: " Claude Code Review Bot
@ 2026-05-16 1:04 ` Claude Code Review Bot
2 siblings, 0 replies; 4+ messages in thread
From: Claude Code Review Bot @ 2026-05-16 1:04 UTC (permalink / raw)
To: dri-devel-reviews
Overall Series Review
Subject: fbcon: Use correct type for vc_resize() return value
Author: Jiacheng Yu <yujiacheng3@huawei.com>
Patches: 2
Reviewed: 2026-05-16T11:04:07.379093
---
This is a single-patch series that fixes a type mismatch warning in `fbcon_set_disp()`. The variable `ret` was declared as `unsigned long` but stores the `int` return value of `vc_resize()`. The fix is correct, trivial, and clearly explained. The patch eliminates a real `-Wconversion` warning with no functional change.
**Verdict: Looks good.** Minor nit below on the Fixes tag.
---
Generated by Claude Code Patch Reviewer
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-05-16 1:04 UTC | newest]
Thread overview: 4+ 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
2026-05-16 1:04 ` Claude review: " Claude Code Review Bot
2026-05-16 1:04 ` Claude Code Review Bot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox