From: Tim Douglas <me@timdoug.com>
To: deller@gmx.de
Cc: linux-fbdev@vger.kernel.org, dri-devel@lists.freedesktop.org,
linux-kernel@vger.kernel.org
Subject: [PATCH] fbdev: valkyriefb: keep the framebuffer mapping size fixed
Date: Tue, 17 Nov 2026 20:58:59 -0500 [thread overview]
Message-ID: <20261118015859.83794-1-me@timdoug.com> (raw)
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@timdoug.com>
---
drivers/video/fbdev/valkyriefb.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/video/fbdev/valkyriefb.c b/drivers/video/fbdev/valkyriefb.c
index ec3cf4589..e067c89c9 100644
--- a/drivers/video/fbdev/valkyriefb.c
+++ b/drivers/video/fbdev/valkyriefb.c
@@ -510,7 +510,7 @@ static void valkyrie_init_fix(struct fb_fix_screeninfo *fix, struct fb_info_valk
fix->mmio_len = sizeof(struct valkyrie_regs);
fix->type = FB_TYPE_PACKED_PIXELS;
fix->smem_start = p->frame_buffer_phys + 0x1000;
- fix->smem_len = p->total_vram;
+ fix->smem_len = p->total_vram - 0x1000;
fix->type_aux = 0;
fix->ywrapstep = 0;
@@ -523,7 +523,6 @@ static void valkyrie_init_fix(struct fb_fix_screeninfo *fix, struct fb_info_valk
static void valkyrie_par_to_fix(struct fb_par_valkyrie *par,
struct fb_fix_screeninfo *fix)
{
- fix->smem_len = valkyrie_vram_reqd(par->vmode, par->cmode);
fix->visual = (par->cmode == CMODE_8) ?
FB_VISUAL_PSEUDOCOLOR : FB_VISUAL_DIRECTCOLOR;
fix->line_length = par->vxres << par->cmode;
base-commit: aebb7274476403040d582c61478df8f4a7bf9cd3
--
2.39.5
reply other threads:[~2026-11-18 1:59 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20261118015859.83794-1-me@timdoug.com \
--to=me@timdoug.com \
--cc=deller@gmx.de \
--cc=dri-devel@lists.freedesktop.org \
--cc=linux-fbdev@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®