From mboxrd@z Thu Jan 1 00:00:00 1970 From: Claude Code Review Bot To: dri-devel-reviews@example.com Subject: Claude review: moduleparam: Add seq_buf-based .get callback alongside .get_str Date: Mon, 25 May 2026 20:11:17 +1000 Message-ID: In-Reply-To: <20260521133326.2465264-6-kees@kernel.org> References: <20260521133315.work.845-kees@kernel.org> <20260521133326.2465264-6-kees@kernel.org> X-Mailer: Claude Code Patch Reviewer Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit MIME-Version: 1.0 Patch Review Adds the new `int (*get)(struct seq_buf *s, const struct kernel_param *kp)` field and the dispatch logic in `param_attr_show()`. The dispatch: - Prefers `.get` if set - Falls back to `.get_str` - `WARN_ON_ONCE` if both are set - On success, derives length from `seq_buf_used()` - On overflow, decrements count by 1 for trailing NUL The overflow handling: ```c + if (seq_buf_has_overflowed(&s)) + count--; ``` This is a bit subtle. When `seq_buf` overflows, `seq_buf_used()` returns `s->size` (the full capacity), and `seq_buf_str()` NUL-terminates at `s->size - 1`. Decrementing `count` by 1 gives `PAGE_SIZE - 1`, which is the correct number of content bytes before the NUL. This matches the old `scnprintf` truncation semantics. Correct. **Verdict: Good design. The return contract (0 for success, negative for errno, positive is WARN) is clearly documented.** --- Generated by Claude Code Patch Reviewer