summaryrefslogtreecommitdiff
path: root/drivers/video/fbdev/core/bitblit.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@kernel.org>2025-11-13 07:58:43 +0100
committerIngo Molnar <mingo@kernel.org>2025-11-13 07:58:43 +0100
commitd851f2b2b273363f65d7285b427bedbb6f8290e2 (patch)
tree38ba3c4b0d4251d7063bcd253c9b914a56165428 /drivers/video/fbdev/core/bitblit.c
parent249092174caa3fe9fb8f7914991a8c0de484bcf8 (diff)
parente9a6fb0bcdd7609be6969112f3fbfcce3b1d4a7c (diff)
downloadlinux-next-d851f2b2b273363f65d7285b427bedbb6f8290e2.tar.gz
linux-next-d851f2b2b273363f65d7285b427bedbb6f8290e2.zip
Merge tag 'v6.18-rc5' into objtool/core, to pick up fixes
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'drivers/video/fbdev/core/bitblit.c')
-rw-r--r--drivers/video/fbdev/core/bitblit.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/drivers/video/fbdev/core/bitblit.c b/drivers/video/fbdev/core/bitblit.c
index a9ec7f488522..dc5ad3fcc7be 100644
--- a/drivers/video/fbdev/core/bitblit.c
+++ b/drivers/video/fbdev/core/bitblit.c
@@ -79,12 +79,16 @@ static inline void bit_putcs_aligned(struct vc_data *vc, struct fb_info *info,
struct fb_image *image, u8 *buf, u8 *dst)
{
u16 charmask = vc->vc_hi_font_mask ? 0x1ff : 0xff;
+ unsigned int charcnt = vc->vc_font.charcount;
u32 idx = vc->vc_font.width >> 3;
u8 *src;
while (cnt--) {
- src = vc->vc_font.data + (scr_readw(s++)&
- charmask)*cellsize;
+ u16 ch = scr_readw(s++) & charmask;
+
+ if (ch >= charcnt)
+ ch = 0;
+ src = vc->vc_font.data + (unsigned int)ch * cellsize;
if (attr) {
update_attr(buf, src, attr, vc);
@@ -112,14 +116,18 @@ static inline void bit_putcs_unaligned(struct vc_data *vc,
u8 *dst)
{
u16 charmask = vc->vc_hi_font_mask ? 0x1ff : 0xff;
+ unsigned int charcnt = vc->vc_font.charcount;
u32 shift_low = 0, mod = vc->vc_font.width % 8;
u32 shift_high = 8;
u32 idx = vc->vc_font.width >> 3;
u8 *src;
while (cnt--) {
- src = vc->vc_font.data + (scr_readw(s++)&
- charmask)*cellsize;
+ u16 ch = scr_readw(s++) & charmask;
+
+ if (ch >= charcnt)
+ ch = 0;
+ src = vc->vc_font.data + (unsigned int)ch * cellsize;
if (attr) {
update_attr(buf, src, attr, vc);