From mboxrd@z Thu Jan 1 00:00:00 1970 From: Claude Code Review Bot To: dri-devel-reviews@example.com Subject: Claude review: scripts: modpost: detect and report truncated buf_printf() output Date: Thu, 28 May 2026 12:21:59 +1000 Message-ID: In-Reply-To: <20260527-nova-exports-v2-1-06de4c556d55@nvidia.com> References: <20260527-nova-exports-v2-0-06de4c556d55@nvidia.com> <20260527-nova-exports-v2-1-06de4c556d55@nvidia.com> X-Mailer: Claude Code Patch Reviewer Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Patch Review **Correctness fix is needed.** The patch correctly identifies that `vsnprin= tf()` returning `len >=3D SZ` means the output was truncated and `buf_write= ()` would read `len` bytes from a `SZ`-sized stack buffer =E2=80=94 a buffe= r over-read. However, the error message has a problem: ```c if (len >=3D SZ) fatal("buf_printf output truncated for string %s: %d bytes needed, %d a= vailable\n", tmp, len + 1, SZ); ``` When `len >=3D SZ`, `tmp` contains a **truncated**, null-terminated string.= Printing it via `%s` is technically safe (it's still null-terminated by `v= snprintf()`), but the message says "for string %s" which shows the *truncat= ed* output, not the full intended string. This is probably good enough for = debugging =E2=80=94 you'll see the start of the symbol name =E2=80=94 but t= he message could be slightly misleading. Consider adding a note like `(trun= cated)` to the output. Also, the `va_end(ap)` was moved before the truncation check, which is corr= ect =E2=80=94 `va_end` should be called before `exit(1)` or `fatal()` to en= sure proper cleanup. Good. Minor style: the kernel modpost code doesn't seem to use braces around sing= le-statement `if` bodies elsewhere, but consistency with the existing `if (= len < 0)` block (which does use braces) is fine. **No blocking issues.** --- Generated by Claude Code Patch Reviewer