public inbox for drm-ai-reviews@public-inbox.freedesktop.org
 help / color / mirror / Atom feed
From: Claude Code Review Bot <claude-review@example.com>
To: dri-devel-reviews@example.com
Subject: Claude review: lib/fonts: Store font data for user space with font_data_export()
Date: Tue, 10 Mar 2026 12:19:45 +1000	[thread overview]
Message-ID: <review-patch12-20260309141723.137364-13-tzimmermann@suse.de> (raw)
In-Reply-To: <20260309141723.137364-13-tzimmermann@suse.de>

Patch Review

**Potential user-visible regression for width 17-24 fonts.**

The old code for `font->width <= 24` used `sizeof(u32)` (4 bytes) as the internal pitch for reading font data:
```c
fontdata += sizeof(u32);  /* 4 bytes per scanline internally */
```
but wrote only 3 bytes to user space. The new code uses `pitch = DIV_ROUND_UP(font->width, 8) = 3` for both reading and writing.

If any existing internal font with width 17-24 stores its data with 4-byte-per-scanline alignment (which the old code assumed), the new code would read the wrong bytes. Let me check: currently there are no built-in fonts with widths in the 17-24 range, so this only affects user-loaded fonts. For user-loaded fonts, `font_data_import()` (patch 11) uses `pitch = DIV_ROUND_UP(width, 8)` which gives 3 for width 17-24. So the import and export are now consistent with each other (both use 3-byte pitch), even though they differ from the old behavior. The commit message addresses this and references user-space code, so this appears intentional.

The padding calculation:
```c
memset(data + glyphsize, 0, pitch * vpitch - glyphsize);
data += pitch * vpitch;
```
Where `glyphsize = font->height * pitch` and the padding is `pitch * (vpitch - font->height)`. This is correct.

The early return for missing data:
```c
if (!font->width || !font->height || !font->charcount || !font->data)
    return 0;
```
This returns success (0) when `font->data` is NULL, which matches the original fbcon code's implicit behavior (it would just skip the copy), but the original code had `if (!font->data) return 0;` explicitly — checking width/height/charcount is new defensive logic that seems fine.

---
Generated by Claude Code Patch Reviewer

  reply	other threads:[~2026-03-10  2:19 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-09 14:14 [PATCH v3 00/13] vc,fbcon,fonts: Proper handling of font data Thomas Zimmermann
2026-03-09 14:14 ` [PATCH v3 01/13] fbdev: Declare src parameter of fb_pad_ helpers as constant Thomas Zimmermann
2026-03-10  2:19   ` Claude review: " Claude Code Review Bot
2026-03-09 14:14 ` [PATCH v3 02/13] vt: Remove trailing whitespaces Thomas Zimmermann
2026-03-10  2:19   ` Claude review: " Claude Code Review Bot
2026-03-09 14:14 ` [PATCH v3 03/13] vt: Store font in struct vc_font Thomas Zimmermann
2026-03-10  2:19   ` Claude review: " Claude Code Review Bot
2026-03-09 14:14 ` [PATCH v3 04/13] vt: Calculate font-buffer size with vc_font_size() Thomas Zimmermann
2026-03-10  2:19   ` Claude review: " Claude Code Review Bot
2026-03-09 14:14 ` [PATCH v3 05/13] lib/fonts: Remove trailing whitespaces Thomas Zimmermann
2026-03-10  2:19   ` Claude review: " Claude Code Review Bot
2026-03-09 14:14 ` [PATCH v3 06/13] lib/fonts: Remove FNTCHARCNT() Thomas Zimmermann
2026-03-10  2:19   ` Claude review: " Claude Code Review Bot
2026-03-09 14:14 ` [PATCH v3 07/13] lib/fonts: Store font data as font_data_t; update consoles Thomas Zimmermann
2026-03-10  2:19   ` Claude review: " Claude Code Review Bot
2026-03-09 14:14 ` [PATCH v3 08/13] lib/fonts: Read font size with font_data_size() Thomas Zimmermann
2026-03-10  2:19   ` Claude review: " Claude Code Review Bot
2026-03-09 14:14 ` [PATCH v3 09/13] lib/fonts: Manage font-data lifetime with font_data_get/_put() Thomas Zimmermann
2026-03-10  2:19   ` Claude review: " Claude Code Review Bot
2026-03-09 14:14 ` [PATCH v3 10/13] lib/fonts: Compare font data for equality with font_data_is_equal() Thomas Zimmermann
2026-03-10  2:19   ` Claude review: " Claude Code Review Bot
2026-03-09 14:14 ` [PATCH v3 11/13] lib/fonts: Create font_data_t from struct console_font with font_data_import() Thomas Zimmermann
2026-03-10  2:19   ` Claude review: " Claude Code Review Bot
2026-03-09 14:14 ` [PATCH v3 12/13] lib/fonts: Store font data for user space with font_data_export() Thomas Zimmermann
2026-03-10  2:19   ` Claude Code Review Bot [this message]
2026-03-09 14:14 ` [PATCH v3 13/13] lib/fonts: Remove internal symbols and macros from public header file Thomas Zimmermann
2026-03-10  2:19   ` Claude review: " Claude Code Review Bot
2026-03-09 14:48 ` [PATCH v3 00/13] vc,fbcon,fonts: Proper handling of font data Helge Deller
2026-03-10  2:19 ` Claude review: " Claude Code Review Bot
  -- strict thread matches above, loose matches on Subject: below --
2026-03-02 14:08 [PATCH v2 00/13] " 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-03  3:19   ` Claude review: " Claude Code Review Bot

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=review-patch12-20260309141723.137364-13-tzimmermann@suse.de \
    --to=claude-review@example.com \
    --cc=dri-devel-reviews@example.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox