From: sashiko-bot@kernel.org
To: "Helge Deller" <deller@kernel.org>, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v3] fbcon: Don't drop last logo line if logo is same size as screen
Date: Fri, 20 Nov 2026 19:58:26 +0000 [thread overview]
Message-ID: <sashiko-outbox-225984@kernel.org> (raw)
In-Reply-To: <awCcqwVKi_n0KMhi@carbonx1>
Thank you for your contribution! Sashiko AI review found 3 potential
issues to consider:
- [High] fbcon: slab-out-of-bounds read in fbcon_prepare_logo() when
cols > new_cols
- [Medium] fbcon: full-screen logo overwritten in fbcon_prepare_logo()
if rows < new_rows
- [Low] fbcon: stale vc_top kept in fbcon_prepare_logo() when dimensions
match
--
commit d343bfc671c341be6e2717c9d73d4817c83b82d0
Author: Helge Deller <deller@kernel.org>
fbcon: Don't drop last logo line if logo is same size as screen
This commit allows bootlogos that match the screen height to use all rows
without dropping the last line, while keeping vc_top unchanged and skipping
update_region() when a logo covers the entire screen.
> diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c
> index 7720dfc80c165..3be7f2ade65cc 100644
> --- a/drivers/video/fbdev/core/fbcon.c
> +++ b/drivers/video/fbdev/core/fbcon.c
> @@ -637,7 +637,7 @@ static void fbcon_prepare_logo(struct vc_data *vc, struct fb_info *info,
> logo_height = fb_prepare_logo(info, par->rotate);
> logo_lines = DIV_ROUND_UP(logo_height, vc->vc_font.height);
> logo_lines = min(logo_lines, rows);
> - logo_lines = min(logo_lines, new_rows - 1);
> + logo_lines = min(logo_lines, new_rows);
> if (logo_lines <= 0) {
> logo_lines = 0;
> logo_shown = FBCON_LOGO_DONTSHOW;
[Severity: High]
Can r underflow vc->vc_origin and cause a slab-out-of-bounds read in
scr_readw(r) when cols > new_cols?
In fbcon_init(), vc_resize(vc, new_cols, new_rows) runs before
fbcon_prepare_logo(), reallocating vc->vc_screenbuf to new_cols * new_rows
characters and setting vc->vc_size_row = 2 * new_cols:
drivers/video/fbdev/core/fbcon.c:fbcon_prepare_logo() {
...
q = (unsigned short *) (vc->vc_origin +
vc->vc_size_row * rows);
step = logo_lines * cols;
for (r = q - logo_lines * cols; r < q; r++)
if (scr_readw(r) != vc->vc_video_erase_char)
break;
...
}
When transitioning from a console such as 80x25 vgacon to a narrower fbcon
(for example new_cols = 79, new_rows = 25, where vgacon_resize() returned
-EINVAL during fbcon_startup() so cols is still 80), allowing logo_lines ==
rows makes logo_lines * cols larger than rows * new_cols. Then r = q -
logo_lines * cols starts before vc->vc_origin.
> @@ -705,7 +705,9 @@ static void fbcon_prepare_logo(struct vc_data *vc, struct fb_info *info,
> pr_info("fbcon: disable boot-logo (boot-logo bigger than screen).\n");
> } else {
> logo_shown = FBCON_LOGO_DRAW;
> - vc->vc_top = logo_lines;
> + /* keep vc_top if logo covers whole screen */
> + if (logo_lines < vc->vc_bottom)
> + vc->vc_top = logo_lines;
> }
> }
> #endif /* MODULE */
[Severity: Medium]
Does a full-screen logo still set vc->vc_top to rows and get partially
overwritten whenever rows < new_rows?
Earlier in fbcon_prepare_logo(), logo_lines is clamped with min(logo_lines,
rows), whereas vc_resize() has already set vc->vc_bottom to new_rows. When
taking over from a smaller console (such as 80x25 vgacon on a display with
more than 25 character rows), logo_lines is clamped to 25 while
vc->vc_bottom is new_rows, so logo_lines < vc->vc_bottom is true even for a
full-screen logo. That sets vc->vc_top = rows, causing fbcon_switch() to
call update_region() after fb_show_logo() and erase the bottom new_rows -
rows lines of the logo.
[Severity: Low]
Can vc->vc_top remain non-zero when logo_lines == vc->vc_bottom if the
console dimensions did not change?
When new_cols == vc->vc_cols and new_rows == vc->vc_rows, vc_do_resize()
returns early via resize_screen() without resetting vc->vc_top to 0. If
vc->vc_top was non-zero prior to fbcon_prepare_logo() (for example from an
earlier scrolling region or console unbind/rebind), skipping the assignment
leaves the stale non-zero vc->vc_top in place, and fbcon_switch() will call
update_region() over the full-screen logo. Explicitly setting vc->vc_top =
0 in an else branch would avoid this.
--
Sashiko AI review · https://sashiko.dev/#/patchset/awCcqwVKi_n0KMhi@carbonx1?part=1
prev parent reply other threads:[~2026-11-20 19:58 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-20 19:16 [PATCH v3] fbcon: Don't drop last logo line if logo is same size as screen Helge Deller
2026-11-20 19:58 ` sashiko-bot [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=sashiko-outbox-225984@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=deller@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=sashiko-reviews@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.