]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
lib/fonts: Compare font data for equality with font_data_is_equal()
authorThomas Zimmermann <tzimmermann@suse.de>
Mon, 9 Mar 2026 14:14:52 +0000 (15:14 +0100)
committerHelge Deller <deller@gmx.de>
Mon, 9 Mar 2026 14:47:21 +0000 (15:47 +0100)
commit1e3c49aa03fbfeea595ca0c9a4ebaf1e9cc078af
treece76d079bb41f55c51f21b6a27da9991c6de3893
parent1de371b1f1b02dc82da598f9707089229699a604
lib/fonts: Compare font data for equality with font_data_is_equal()

Add font_data_is_equal() and update consoles to use it.

Font data is equal if it has the same size and contains the same values
on all bytes. Only fbcon uses a crc32 checksum. If set in both operands
the checksums have to be equal.

The new helper also guarantees to not compare internal fonts against
fonts from user space. Internal fonts cannot be ref-counted, so making
them equal to user-space fonts with the same byte sequence results in
undefined behavior.

The test only compares data buffers. Their interpretation is up each
console. Therefore remove a width test in fbcon_set_font().

v3:
- rebase onto font_data_{get,put}()

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Signed-off-by: Helge Deller <deller@gmx.de>
drivers/video/console/newport_con.c
drivers/video/fbdev/core/fbcon.c
include/linux/font.h
lib/fonts/fonts.c