aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorAntonino A. Daplas <adaplas@gmail.com>2007-05-08 03:39:19 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-05-08 14:15:31 -0400
commit38b4982c6388ae9596f959e3d7fef91affbd181d (patch)
treefb3938204e811886c2793908dca528e20b40f665 /drivers
parentff388ad05bc67163124ac74126bbc16faa2fb771 (diff)
fbcon: check if the character count can be handled
Fontmaps can be 256 or 512 in length. The only driver that can do tileblitting can only handle 256 characters. Check for this when setting the font. Signed-off-by: Antonino Daplas <adaplas@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/video/console/fbcon.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/drivers/video/console/fbcon.c b/drivers/video/console/fbcon.c
index c71a88d531cd..6fc3501581d6 100644
--- a/drivers/video/console/fbcon.c
+++ b/drivers/video/console/fbcon.c
@@ -685,6 +685,17 @@ static void set_blitting_type(struct vc_data *vc, struct fb_info *info)
685 fbcon_set_bitops(ops); 685 fbcon_set_bitops(ops);
686 } 686 }
687} 687}
688
689static int fbcon_invalid_charcount(struct fb_info *info, unsigned charcount)
690{
691 int err = 0;
692
693 if (info->flags & FBINFO_MISC_TILEBLITTING &&
694 info->tileops->fb_get_tilemax(info) < charcount)
695 err = 1;
696
697 return err;
698}
688#else 699#else
689static void set_blitting_type(struct vc_data *vc, struct fb_info *info) 700static void set_blitting_type(struct vc_data *vc, struct fb_info *info)
690{ 701{
@@ -695,6 +706,12 @@ static void set_blitting_type(struct vc_data *vc, struct fb_info *info)
695 fbcon_set_rotation(info); 706 fbcon_set_rotation(info);
696 fbcon_set_bitops(ops); 707 fbcon_set_bitops(ops);
697} 708}
709
710static int fbcon_invalid_charcount(struct fb_info *info, unsigned charcount)
711{
712 return 0;
713}
714
698#endif /* CONFIG_MISC_TILEBLITTING */ 715#endif /* CONFIG_MISC_TILEBLITTING */
699 716
700 717
@@ -2518,6 +2535,10 @@ static int fbcon_set_font(struct vc_data *vc, struct console_font *font, unsigne
2518 !(info->pixmap.blit_y & (1 << (font->height - 1)))) 2535 !(info->pixmap.blit_y & (1 << (font->height - 1))))
2519 return -EINVAL; 2536 return -EINVAL;
2520 2537
2538 /* Make sure driver can handle the font length */
2539 if (fbcon_invalid_charcount(info, charcount))
2540 return -EINVAL;
2541
2521 size = h * pitch * charcount; 2542 size = h * pitch * charcount;
2522 2543
2523 new_data = kmalloc(FONT_EXTRA_WORDS * sizeof(int) + size, GFP_USER); 2544 new_data = kmalloc(FONT_EXTRA_WORDS * sizeof(int) + size, GFP_USER);