From mboxrd@z Thu Jan 1 00:00:00 1970 From: Claude Code Review Bot To: dri-devel-reviews@example.com Subject: Claude review: lib/fonts: Create font_data_t from struct console_font with font_data_import() Date: Tue, 03 Mar 2026 13:19:16 +1000 Message-ID: In-Reply-To: <20260302141255.518657-12-tzimmermann@suse.de> References: <20260302141255.518657-1-tzimmermann@suse.de> <20260302141255.518657-12-tzimmermann@suse.de> X-Mailer: Claude Code Patch Reviewer Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Patch Review Centralizes the font import logic from fbcon and newport_con. **Issue 1**: The `int size` and `int alloc_size` variables are signed but u= sed for sizes. While the `check_mul_overflow` / `check_add_overflow` macros= handle this correctly (they detect overflow for the destination type), usi= ng `unsigned int` would be more idiomatic for size values. This matches the= pattern from the original fbcon code though. **Issue 2**: The source-side memcpy index is not overflow-checked: ```c for (i =3D 0; i < charcount; ++i) memcpy(font_data->data + i * h * pitch, data + i * vpitch * pitch, h * = pitch); ``` `i * vpitch * pitch` on the source side could overflow if `vpitch` is large= . `vpitch` comes from user space (the VT ioctl). While the existing code ha= d the same pattern, this is the "proper" refactored version =E2=80=94 addin= g `check_mul_overflow` for `vpitch * pitch` and `i * vpitch * pitch` would = improve robustness. In practice, vpitch is typically 32 and pitch is at mos= t 4, so the maximum is `512 * 32 * 4 =3D 65536`, well within range. **Issue 3**: The doc comment says `@calc_sum` but the parameter is `calc_cs= um`, and "chechsum" should be "checksum". The newport_con simplification removing the `vpitch !=3D 32` check is a goo= d improvement =E2=80=94 newport_con previously rejected fonts where vpitch = !=3D 32, but font_data_import handles any vpitch correctly. --- Generated by Claude Code Patch Reviewer