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: scripts: modpost: detect and report truncated buf_printf() output
Date: Thu, 28 May 2026 12:21:59 +1000	[thread overview]
Message-ID: <review-patch1-20260527-nova-exports-v2-1-06de4c556d55@nvidia.com> (raw)
In-Reply-To: <20260527-nova-exports-v2-1-06de4c556d55@nvidia.com>

Patch Review

**Correctness fix is needed.** The patch correctly identifies that `vsnprintf()` returning `len >= SZ` means the output was truncated and `buf_write()` would read `len` bytes from a `SZ`-sized stack buffer — a buffer over-read.

However, the error message has a problem:

```c
if (len >= SZ)
    fatal("buf_printf output truncated for string %s: %d bytes needed, %d available\n",
          tmp, len + 1, SZ);
```

When `len >= SZ`, `tmp` contains a **truncated**, null-terminated string. Printing it via `%s` is technically safe (it's still null-terminated by `vsnprintf()`), but the message says "for string %s" which shows the *truncated* output, not the full intended string. This is probably good enough for debugging — you'll see the start of the symbol name — but the message could be slightly misleading. Consider adding a note like `(truncated)` to the output.

Also, the `va_end(ap)` was moved before the truncation check, which is correct — `va_end` should be called before `exit(1)` or `fatal()` to ensure proper cleanup. Good.

Minor style: the kernel modpost code doesn't seem to use braces around single-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

  parent reply	other threads:[~2026-05-28  2:21 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-27 11:52 [PATCH v2 0/7] gpu: drm: nova: enable calling into nova-core Alexandre Courbot
2026-05-27 11:52 ` [PATCH v2 1/7] scripts: modpost: detect and report truncated buf_printf() output Alexandre Courbot
2026-05-27 17:18   ` Nathan Chancellor
2026-05-28  2:21   ` Claude Code Review Bot [this message]
2026-05-27 11:52 ` [PATCH v2 2/7] pin_init: always inline the #ident and #project_ident methods Alexandre Courbot
2026-05-27 17:49   ` Gary Guo
2026-05-28  2:22   ` Claude review: " Claude Code Review Bot
2026-05-27 11:52 ` [PATCH v2 3/7] rust: always inline some init methods Alexandre Courbot
2026-05-27 17:54   ` Gary Guo
2026-05-28  2:22   ` Claude review: " Claude Code Review Bot
2026-05-27 11:52 ` [PATCH v2 4/7] gpu: nova-core: export Rust symbols for dependent modules Alexandre Courbot
2026-05-28  2:22   ` Claude review: " Claude Code Review Bot
2026-05-27 11:52 ` [PATCH v2 5/7] gpu: nova-core: emit Rust metadata " Alexandre Courbot
2026-05-28  2:22   ` Claude review: " Claude Code Review Bot
2026-05-27 11:52 ` [PATCH v2 6/7] gpu: drm: nova: build after nova-core metadata Alexandre Courbot
2026-05-28  2:22   ` Claude review: " Claude Code Review Bot
2026-05-27 11:52 ` [PATCH POC v2 7/7] drm: nova: demonstrate interaction with nova-core Alexandre Courbot
2026-05-28  2:22   ` Claude review: " Claude Code Review Bot
2026-05-28  2:21 ` Claude review: gpu: drm: nova: enable calling into nova-core Claude Code Review Bot
  -- strict thread matches above, loose matches on Subject: below --
2026-04-30 14:55 [PATCH 0/7] " Alexandre Courbot
2026-04-30 14:55 ` [PATCH 1/7] scripts: modpost: detect and report truncated buf_printf() output Alexandre Courbot
2026-05-05  0:17   ` 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-patch1-20260527-nova-exports-v2-1-06de4c556d55@nvidia.com \
    --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