Re: [PATCH] fbdev: valkyriefb: keep the framebuffer mapping size fixed

From: Helge Deller

Date: Wed Nov 18 2026 - 14:03:54 EST


On 11/18/26 02:58, Tim Douglas wrote:
When /dev/fb0 is mapped before a depth change, as with Xorg's fbdev
driver, the mapping may be too short for the new mode. At 640x480,
a full frame at 16 bpp is 600 KiB, so drawing it through the
original 300 KiB mapping from 8 bpp can fault.

Set smem_len to the usable video RAM by subtracting the 4 KiB offset
already applied to smem_start, then keep that size across mode
changes.

On a Performa 6200CD using a kernel with local platform support,
a write past the mapping caused a fault during an Xorg test at
16 bpp. With the corrected mapping size in the test kernel, twm
and xterm were displayed successfully in Xorg at 640x480 and 16 bpp.

In a test on a Quadra 630 in MAME with Linux v7.4-rc3, /dev/fb0 was
mapped at 8 bpp and the depth was changed to 16 bpp with the original
mapping still in place. A SIGSEGV was reported during the 16 bpp draw
before the fix, and all 480 lines were drawn afterward.

AI assistance was used to investigate the mapping size and draft
the fix.

Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Signed-off-by: Tim Douglas <me@xxxxxxxxxxx>
---
drivers/video/fbdev/valkyriefb.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
applied.

Thanks!
Helge