Skip to content

Commit 272d708

Browse files
peilin-yedanvet
authored andcommitted
Fonts: Support FONT_EXTRA_WORDS macros for font_6x8
Recently, in commit 6735b46 ("Fonts: Support FONT_EXTRA_WORDS macros for built-in fonts"), we wrapped each of our built-in data buffers in a `font_data` structure, in order to use the following macros on them, see include/linux/font.h: #define REFCOUNT(fd) (((int *)(fd))[-1]) #define FNTSIZE(fd) (((int *)(fd))[-2]) #define FNTCHARCNT(fd) (((int *)(fd))[-3]) #define FNTSUM(fd) (((int *)(fd))[-4]) #define FONT_EXTRA_WORDS 4 Do the same thing to our new 6x8 font. For built-in fonts, currently we only use FNTSIZE(). Since this is only a temporary solution for an out-of-bounds issue in the framebuffer layer (see commit 5af0864 ("fbcon: Fix global-out-of-bounds read in fbcon_get_font()")), all the three other fields are intentionally set to zero in order to discourage using these negative-indexing macros. Signed-off-by: Peilin Ye <yepeilin.cs@gmail.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> Link: https://patchwork.freedesktop.org/patch/msgid/926453876c92caac34cba8545716a491754d04d5.1603037079.git.yepeilin.cs@gmail.com
1 parent eda4a7b commit 272d708

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

lib/fonts/font_6x8.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33

44
#define FONTDATAMAX 2048
55

6-
static const unsigned char fontdata_6x8[FONTDATAMAX] = {
7-
6+
static struct font_data fontdata_6x8 = {
7+
{ 0, 0, FONTDATAMAX, 0 }, {
88
/* 0 0x00 '^@' */
99
0x00, /* 000000 */
1010
0x00, /* 000000 */
@@ -2564,13 +2564,13 @@ static const unsigned char fontdata_6x8[FONTDATAMAX] = {
25642564
0x00, /* 000000 */
25652565
0x00, /* 000000 */
25662566
0x00, /* 000000 */
2567-
};
2567+
} };
25682568

25692569
const struct font_desc font_6x8 = {
25702570
.idx = FONT6x8_IDX,
25712571
.name = "6x8",
25722572
.width = 6,
25732573
.height = 8,
2574-
.data = fontdata_6x8,
2574+
.data = fontdata_6x8.data,
25752575
.pref = 0,
25762576
};

0 commit comments

Comments
 (0)