All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nathan Chancellor <nathan@kernel.org>
To: Thomas Zimmermann <tzimmermann@suse.de>
Cc: gregkh@linuxfoundation.org, deller@gmx.de, sam@ravnborg.org,
	linux-fbdev@vger.kernel.org, dri-devel@lists.freedesktop.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 09/13] lib/fonts: Compare font data for equality with font_data_is_equal()
Date: Wed, 4 Mar 2026 17:23:47 -0700	[thread overview]
Message-ID: <20260305002347.GA4102761@ax162> (raw)
In-Reply-To: <20260302141255.518657-10-tzimmermann@suse.de>

Hi Thomas,

On Mon, Mar 02, 2026 at 03:08:43PM +0100, Thomas Zimmermann wrote:
...
> diff --git a/lib/fonts/fonts.c b/lib/fonts/fonts.c
> index 8c9a6762061c..c9f6328d5dda 100644
> --- a/lib/fonts/fonts.c
> +++ b/lib/fonts/fonts.c
> @@ -12,18 +12,25 @@
>   * for more details.
>   */
>  
> +#include <linux/font.h>
>  #include <linux/module.h>
> -#include <linux/types.h>
>  #include <linux/string.h>
> +#include <linux/types.h>
> +
> +#include <asm/sections.h>
>  #if defined(__mc68000__)
>  #include <asm/setup.h>
>  #endif
> -#include <linux/font.h>
>  
>  /*
>   * Helpers for font_data_t
>   */
>  
> +static bool font_data_is_internal(font_data_t *fd)
> +{
> +	return is_kernel_rodata((unsigned long)fd);
> +}
> +
>  /**
>   * font_data_size - Return size of the font data in bytes
>   * @fd: Font data
> @@ -37,6 +44,32 @@ unsigned int font_data_size(font_data_t *fd)
>  }
>  EXPORT_SYMBOL_GPL(font_data_size);
>  
> +/**
> + * font_data_is_equal - Compares font data for equality
> + * @lhs: Left-hand side font data
> + * @rhs: Right-hand-size font data
> + *
> + * Font data is equal if is constain the same sequence of values. The
> + * helper also use the checksum, if both arguments contain it. Font data
> + * coming from different origins, internal or from user space, is never
> + * equal. Allowing this would break reference counting.
> + *
> + * Returns:
> + * True if the given font data is equal, false otherwise.
> + */
> +bool font_data_is_equal(font_data_t *lhs, font_data_t *rhs)
> +{
> +	if (font_data_is_internal(lhs) != font_data_is_internal(rhs))
> +		return false;

This breaks the build when CONFIG_FONT_SUPPORT is a module.

  $ cat allno.config
  CONFIG_MODULES=y
  CONFIG_DRM=m
  CONFIG_DRM_PANIC=y

  $ make -skj"$(nproc)" ARCH=x86_64 CROSS_COMPILE=x86_64-linux- KCONFIG_ALLCONFIG=1 allnoconfig all
  ERROR: modpost: "__end_rodata" [lib/fonts/font.ko] undefined!
  make[4]: *** [scripts/Makefile.modpost:147: Module.symvers] Error 1
  ...

  $ scripts/config -s FONT_SUPPORT
  m

Cheers,
Nathan

> +	if (font_data_size(lhs) != font_data_size(rhs))
> +		return false;
> +	if (FNTSUM(lhs) && FNTSUM(rhs) && FNTSUM(lhs) != FNTSUM(rhs))
> +		return false;
> +
> +	return !memcmp(lhs, rhs, FNTSIZE(lhs));
> +}
> +EXPORT_SYMBOL_GPL(font_data_is_equal);
> +
>  /*
>   * Font lookup
>   */
> -- 
> 2.53.0
> 

  reply	other threads:[~2026-03-05  0:23 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-02 14:08 [PATCH v2 00/13] vc,fbcon,fonts: Proper handling of font data Thomas Zimmermann
2026-03-02 14:08 ` [PATCH v2 01/13] fbdev: Declare src parameter of fb_pad_ helpers as constant Thomas Zimmermann
2026-03-02 14:08 ` [PATCH v2 02/13] vt: Remove trailing whitespaces Thomas Zimmermann
2026-03-02 14:08 ` [PATCH v2 03/13] vt: Store font in struct vc_font Thomas Zimmermann
2026-03-03 14:31   ` Helge Deller
2026-03-04  7:49     ` Thomas Zimmermann
2026-03-02 14:08 ` [PATCH v2 04/13] vt: Calculate font-buffer size with vc_font_size() Thomas Zimmermann
2026-03-02 14:08 ` [PATCH v2 05/13] lib/fonts: Remove trailing whitespaces Thomas Zimmermann
2026-03-02 14:08 ` [PATCH v2 06/13] lib/fonts: Remove FNTCHARCNT() Thomas Zimmermann
2026-03-02 14:08 ` [PATCH v2 07/13] lib/fonts: Store font data as font_data_t; update consoles Thomas Zimmermann
2026-03-03 14:57   ` Helge Deller
2026-03-04  7:51     ` Thomas Zimmermann
2026-03-02 14:08 ` [PATCH v2 08/13] lib/fonts: Read font size with font_data_size() Thomas Zimmermann
2026-03-02 14:08 ` [PATCH v2 09/13] lib/fonts: Compare font data for equality with font_data_is_equal() Thomas Zimmermann
2026-03-05  0:23   ` Nathan Chancellor [this message]
2026-03-05  9:31     ` Thomas Zimmermann
2026-03-05 20:12       ` Nathan Chancellor
2026-03-02 14:08 ` [PATCH v2 10/13] lib/fonts: Manage font-data lifetime with font_data_get/_put() Thomas Zimmermann
2026-03-02 14:08 ` [PATCH v2 11/13] lib/fonts: Create font_data_t from struct console_font with font_data_import() Thomas Zimmermann
2026-03-02 14:08 ` [PATCH v2 12/13] lib/fonts: Store font data for user space with font_data_export() Thomas Zimmermann
2026-03-02 14:08 ` [PATCH v2 13/13] lib/fonts: Remove internal symbols and macros from public header file Thomas Zimmermann
2026-03-03 15:29 ` [PATCH v2 00/13] vc,fbcon,fonts: Proper handling of font data Helge Deller
2026-03-04  9:11   ` Thomas Zimmermann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260305002347.GA4102761@ax162 \
    --to=nathan@kernel.org \
    --cc=deller@gmx.de \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-fbdev@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sam@ravnborg.org \
    --cc=tzimmermann@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.