Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

lib/fonts: Read font size with font_data_size()

Add font_data_size() and update consoles to use it.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Signed-off-by: Helge Deller <deller@gmx.de>

authored by

Thomas Zimmermann and committed by
Helge Deller
e2e000a0 04bd5abc

+31 -8
+1 -1
drivers/video/console/newport_con.c
··· 530 530 /* check if font is already used by other console */ 531 531 for (i = 0; i < MAX_NR_CONSOLES; i++) { 532 532 if (font_data[i] != FONT_DATA 533 - && FNTSIZE(font_data[i]) == size 533 + && font_data_size(font_data[i]) == size 534 534 && !memcmp(font_data[i], new_data, size)) { 535 535 kfree(new_data - FONT_EXTRA_WORDS * sizeof(int)); 536 536 /* current font is the same as the new one */
+7 -7
drivers/video/fbdev/core/fbcon.c
··· 2053 2053 struct fb_var_screeninfo var = info->var; 2054 2054 int x_diff, y_diff, virt_w, virt_h, virt_fw, virt_fh; 2055 2055 2056 - if (p->userfont && FNTSIZE(p->fontdata)) { 2056 + if (p->userfont && font_data_size(p->fontdata)) { 2057 2057 unsigned int size = vc_font_size(&vc->vc_font); 2058 2058 2059 2059 /* ··· 2063 2063 * charcount can change and cannot be used to determine the 2064 2064 * font data allocated size. 2065 2065 */ 2066 - if (!size || size > FNTSIZE(p->fontdata)) 2066 + if (!size || size > font_data_size(p->fontdata)) 2067 2067 return -EINVAL; 2068 2068 } 2069 2069 ··· 2302 2302 2303 2303 if (font->width <= 8) { 2304 2304 j = vc->vc_font.height; 2305 - if (font->charcount * j > FNTSIZE(fontdata)) 2305 + if (font->charcount * j > font_data_size(fontdata)) 2306 2306 return -EINVAL; 2307 2307 2308 2308 for (i = 0; i < font->charcount; i++) { ··· 2313 2313 } 2314 2314 } else if (font->width <= 16) { 2315 2315 j = vc->vc_font.height * 2; 2316 - if (font->charcount * j > FNTSIZE(fontdata)) 2316 + if (font->charcount * j > font_data_size(fontdata)) 2317 2317 return -EINVAL; 2318 2318 2319 2319 for (i = 0; i < font->charcount; i++) { ··· 2323 2323 fontdata += j; 2324 2324 } 2325 2325 } else if (font->width <= 24) { 2326 - if (font->charcount * (vc->vc_font.height * sizeof(u32)) > FNTSIZE(fontdata)) 2326 + if (font->charcount * (vc->vc_font.height * sizeof(u32)) > font_data_size(fontdata)) 2327 2327 return -EINVAL; 2328 2328 2329 2329 for (i = 0; i < font->charcount; i++) { ··· 2338 2338 } 2339 2339 } else { 2340 2340 j = vc->vc_font.height * 4; 2341 - if (font->charcount * j > FNTSIZE(fontdata)) 2341 + if (font->charcount * j > font_data_size(fontdata)) 2342 2342 return -EINVAL; 2343 2343 2344 2344 for (i = 0; i < font->charcount; i++) { ··· 2553 2553 if (fb_display[i].userfont && 2554 2554 fb_display[i].fontdata && 2555 2555 FNTSUM(fb_display[i].fontdata) == csum && 2556 - FNTSIZE(fb_display[i].fontdata) == size && 2556 + font_data_size(fb_display[i].fontdata) == size && 2557 2557 tmp->vc_font.width == w && 2558 2558 !memcmp(fb_display[i].fontdata, new_data, size)) { 2559 2559 kfree(new_data - FONT_EXTRA_WORDS * sizeof(int));
+2
include/linux/font.h
··· 54 54 return (const unsigned char *)fd; 55 55 } 56 56 57 + unsigned int font_data_size(font_data_t *fd); 58 + 57 59 /* 58 60 * Font description 59 61 */
+21
lib/fonts/fonts.c
··· 20 20 #endif 21 21 #include <linux/font.h> 22 22 23 + /* 24 + * Helpers for font_data_t 25 + */ 26 + 27 + /** 28 + * font_data_size - Return size of the font data in bytes 29 + * @fd: Font data 30 + * 31 + * Returns: 32 + * The number of bytes in the given font data. 33 + */ 34 + unsigned int font_data_size(font_data_t *fd) 35 + { 36 + return FNTSIZE(fd); 37 + } 38 + EXPORT_SYMBOL_GPL(font_data_size); 39 + 40 + /* 41 + * Font lookup 42 + */ 43 + 23 44 static const struct font_desc *fonts[] = { 24 45 #ifdef CONFIG_FONT_8x8 25 46 &font_vga_8x8,