From mboxrd@z Thu Jan 1 00:00:00 1970 From: Claude Code Review Bot To: dri-devel-reviews@example.com Subject: Claude review: staging: fbtft: Use sysfs_emit_at() to print to sysfs file Date: Thu, 04 Jun 2026 11:55:20 +1000 Message-ID: In-Reply-To: References: X-Mailer: Claude Code Patch Reviewer Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Patch Review **The bug:** In `sprintf_gamma()` at line 101, the original code passes `PA= GE_SIZE` as the size limit to `scnprintf()`: ```c len +=3D scnprintf(&buf[len], PAGE_SIZE, "%04x ", curves[i * par->gamma.num_values + j]); ``` Since the write starts at `&buf[len]`, the correct limit should be `PAGE_SI= ZE - len`. Passing the full `PAGE_SIZE` means `scnprintf` thinks it has mor= e buffer space than actually remains, which could theoretically write past = the end of the page-sized sysfs buffer. **The fix:** Replaces this with `sysfs_emit_at(buf, len, ...)`: ```c len +=3D sysfs_emit_at(buf, len, "%04x ", curves[i * par->gamma.num_values + j]); ``` `sysfs_emit_at()` internally computes `PAGE_SIZE - offset` for the limit an= d also adds safety checks (page-alignment verification, offset bounds check= ing), making it the correct and idiomatic API for sysfs show callbacks. **Correctness:** Verified that this is indeed a sysfs context =E2=80=94 `sp= rintf_gamma()` is called from `show_gamma_curve()` (line 142), which is the= show callback registered via `__ATTR(gamma, 0660, show_gamma_curve, store_= gamma_curve)` at line 146. The companion function `show_debug()` at line 19= 8 already uses `sysfs_emit()`, so this change also improves consistency wit= hin the file. **Practical impact:** As the commit message correctly notes, the max output= is `FBTFT_GAMMA_MAX_VALUES_TOTAL` (128) u32 values formatted as `"%04x "` = (5 chars each) =3D ~640 bytes, well under `PAGE_SIZE` (4096). So this is a = correctness fix rather than a security-critical one, but still worth having. **No issues found.** Reviewed-by worthy. --- Generated by Claude Code Patch Reviewer