Re: [PATCH] fbdev: cirrusfb: Fix overflow in the video memory check

From: Wang, Weidong

Date: Wed Nov 25 2026 - 23:09:58 EST


On 11/18/26 19:48, Helge Deller wrote:
> can't you simply check xres_virtual and yres_virtual values
> against sane values, e.g. bail out if each of them is bigger than
> e.g. 16384 pixels ?

Yes, that is simpler, and bounding both values keeps the 32-bit
product from wrapping. I will send a v2 that does this.

One adjustment for yres_virtual: at 1 bpp a 4 MiB card holds 52428
lines of 640 pixels, and the driver picks that value itself when
yres_virtual is -1 ("use highest possible virtual resolution"), so
a 16384 limit would reject a mode that works today. v2 would reject
xres_virtual > 16384 and yres_virtual > 65536 (the product then
stays below 2^30), and cap the value the driver computes for
yres_virtual == -1 at the same limit. Does that work for you?

v2 will also correct the Fixes tag to 09a2910e5464 ("cirrusfb:
check_par fixes"), which added this check, as the sashiko review
pointed out.

Thanks,
Weidong