Patch for fbcon not letting to read console font if it's width is 17-24 (3 bytes pitch)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



staging: drivers: video: fbdev: core: fbcon: Fix getting font from fbcon

The patch fixes the problem of getting fonts from fbcon when the font's width spans over 3 bytes.
The bug can be reproduced inside linux console running fbcon in following way:

Set font with width in range 17-24, ie: solar24x32.psfu can be downloaded from kbd package
> setfont /usr/share/consolefonts/solar24x32.psfu

Try to read it back:
> setfont -O font.psfu

Before the fix, it will diplay:
> get_font: GIO_FONT: Invalid argument

On patched kernel it will output font.psfu file
Now we can confirm it is a valid font file:
> setfont font.psfu

Signed-off-by: Marcin Sokalski <msokalski@xxxxxxxxxxxxxxxxxx>

diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c
index 99ecd9a6d844..1f599872cae5 100644
--- a/drivers/video/fbdev/core/fbcon.c
+++ b/drivers/video/fbdev/core/fbcon.c
@@ -1806,18 +1806,15 @@ static int fbcon_get_font(struct vc_data *vc, struct console_font *font)
  fontdata += j;
  }
  } else if (font->width <= 24) {
- if (font->charcount * (vc->vc_font.height * sizeof(u32)) > FNTSIZE(fontdata))
+ j = vc->vc_font.height * 3;
+ if (font->charcount * j > FNTSIZE(fontdata))
  return -EINVAL;
 
  for (i = 0; i < font->charcount; i++) {
- for (j = 0; j < vc->vc_font.height; j++) {
- *data++ = fontdata[0];
- *data++ = fontdata[1];
- *data++ = fontdata[2];
- fontdata += sizeof(u32);
- }
- memset(data, 0, 3 * (32 - j));
- data += 3 * (32 - j);
+ memcpy(data, fontdata, j);
+ memset(data + j, 0, 96 - j);
+ data += 96;
+ fontdata += j;
  }
  } else {
  j = vc->vc_font.height * 4;

CONFIDENTIALITY NOTICE
------------------------------------
This E-mail is intended only to be read or used by the addressee.The information contained in this E-mail message may be confidential information. If you are not the intended recipient, any use, interference with, distribution, disclosure or copying of this material is unauthorised and prohibited. Confidentiality attached to this communication is not waived or lost by reason of the mistaken delivery to you.
If you have received this message in error, please delete it and notify us by return E-mail or telephone NOVOMATIC Technologies Poland Sp. z o.o. +48 12 258 00 50. Any E-mail attachment may contain software viruses which could damage your own computer system. Whilst reasonable precaution has been taken to minimize this risk, we cannot accept liability for any damage which you sustain as a result of software viruses. You should therefore carry out your own virus checks before opening any attachments.
------------------------------------
NOVOMATIC Technologies Poland Sp. z o.o., Poland, Krakowska 368, 32-080 Zabierzów

[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux