Commit 167f07f1 authored by Antonino A. Daplas's avatar Antonino A. Daplas Committed by Linus Torvalds

fbcon: check console-fb mapping in fbcon_get_requirement

- Check the console-to-fb mapping in fbcon_get_requirement(), otherwise the
  value returned may not be valid for the driver.

- Minor cleanup
Signed-off-by: default avatarAntonino Daplas <adaplas@gmail.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent b1e7223f
...@@ -3048,14 +3048,14 @@ static void fbcon_get_requirement(struct fb_info *info, ...@@ -3048,14 +3048,14 @@ static void fbcon_get_requirement(struct fb_info *info,
{ {
struct vc_data *vc; struct vc_data *vc;
struct display *p; struct display *p;
int charcnt;
if (caps->flags) { if (caps->flags) {
int i; int i, charcnt;
for (i = first_fb_vc; i <= last_fb_vc; i++) { for (i = first_fb_vc; i <= last_fb_vc; i++) {
vc = vc_cons[i].d; vc = vc_cons[i].d;
if (vc && vc->vc_mode == KD_TEXT) { if (vc && vc->vc_mode == KD_TEXT &&
info->node == con2fb_map[i]) {
p = &fb_display[i]; p = &fb_display[i];
caps->x |= 1 << (vc->vc_font.width - 1); caps->x |= 1 << (vc->vc_font.width - 1);
caps->y |= 1 << (vc->vc_font.height - 1); caps->y |= 1 << (vc->vc_font.height - 1);
...@@ -3068,14 +3068,13 @@ static void fbcon_get_requirement(struct fb_info *info, ...@@ -3068,14 +3068,13 @@ static void fbcon_get_requirement(struct fb_info *info,
} else { } else {
vc = vc_cons[fg_console].d; vc = vc_cons[fg_console].d;
if (vc && vc->vc_mode == KD_TEXT) { if (vc && vc->vc_mode == KD_TEXT &&
info->node == con2fb_map[fg_console]) {
p = &fb_display[fg_console]; p = &fb_display[fg_console];
caps->x |= 1 << (vc->vc_font.width - 1); caps->x = 1 << (vc->vc_font.width - 1);
caps->y |= 1 << (vc->vc_font.height - 1); caps->y = 1 << (vc->vc_font.height - 1);
charcnt = (p->userfont) ? caps->len = (p->userfont) ?
FNTCHARCNT(p->fontdata) : 256; FNTCHARCNT(p->fontdata) : 256;
if (caps->len < charcnt)
caps->len = charcnt;
} }
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment