All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Weidong Wang" <weidongw@illinois.edu>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH] fbdev: cirrusfb: Fix overflow in the video memory check
Date: Thu, 12 Nov 2026 06:50:22 +0000	[thread overview]
Message-ID: <sashiko-outbox-210536@kernel.org> (raw)
In-Reply-To: <20261112-c4-n053-v1-1-1e45ef75304c@illinois.edu>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] fbdev: cirrusfb: inaccurate Fixes trailer in
  cirrusfb_check_var() commit
--

commit fe8f501c4d16cf488da84bae27d1a683a157b106
Author: Weidong Wang <weidongw@illinois.edu>

> fbdev: cirrusfb: Fix overflow in the video memory check
>
> cirrusfb_check_var() raises xres_virtual to xres and then checks
> xres_virtual * yres_virtual against the video memory in 32-bit
> arithmetic. fb_set_var() checks the product for overflow, but only for
> the values passed in, before the driver raises xres_virtual. A mode with
> xres 65536, xres_virtual 640 and yres_virtual 65536 passes that check,
> becomes 65536 x 65536 in cirrusfb_check_var(), and the product wraps to
> 0, so the mode is accepted on a 4 MiB card with a line length of
> 65536 bytes. The framebuffer console then draws at offsets far past the
> end of the video memory mapping.
>
> Do the multiplication in 64 bits.
>
> Found by an AI code review agent (an LLM-based bug-finding tool
> developed by Zijie Zhao and the submitter) and confirmed on an
> unmodified kernel, without error injection, on x86_64 under QEMU with
> -vga cirrus (GD5446, 4 MiB) and KASAN. FBIOPUT_VSCREENINFO with
> xres 65536, yres 128, xres_virtual 640, yres_virtual 65536 at 8 bpp is
> accepted as 65536x128, virtual 65536x65536. Booted with
> video=cirrusfb:noaccel, fbcon's redraw then faults:
>
>   BUG: unable to handle page fault for address: ffffc90000b00000
>   RIP: 0010:cfb_imageblit+0xbc6/0x1970
>    soft_cursor+0x5eb/0xcd0
>    bit_cursor+0xb41/0x1910
>    hide_cursor+0x6e/0x1d0
>
> With acceleration enabled, text on the GD5446 is drawn with the blitter,
> which QEMU bounds, so the mode is accepted but nothing faults; drawing
> goes through the CPU with noaccel and on the Laguna chips, which always
> run without acceleration. Asked for without the wrap, as 65536x128 with
> a 65536x128 virtual resolution (8 MiB), the mode is rejected, as it
> should be.
>
> With this patch the mode is rejected with "virtual resolution too high
> to fit into video memory", and 1024x768x8 is still accepted.
>
> The reproducer, fix and changelog were drafted with AI assistance
> (Claude), then reviewed and tested by the submitter.
>
> Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
> Cc: stable@vger.kernel.org
> Cc: Zijie Zhao <zijie4@illinois.edu>
> Signed-off-by: Weidong Wang <weidongw@illinois.edu>

[Severity: Low]
Raising var->xres_virtual to var->xres and checking var->xres_virtual *
var->yres_virtual > pixels in cirrusfb_check_var() was introduced by
09a2910e5464 ("cirrusfb: check_par fixes").  Should the Fixes tag be:

  Fixes: 09a2910e5464 ("cirrusfb: check_par fixes")

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261112-c4-n053-v1-1-1e45ef75304c@illinois.edu?part=1

      reply	other threads:[~2026-11-12  6:50 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-12  6:37 [PATCH] fbdev: cirrusfb: Fix overflow in the video memory check Weidong Wang
2026-11-12  6:37 ` Weidong Wang via B4 Relay
2026-11-12  6:50 ` 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-210536@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=weidongw@illinois.edu \
    /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.