From: Claude Code Review Bot <claude-review@example.com>
To: dri-devel-reviews@example.com
Subject: Claude review: nouveau/vmm: use kzalloc_flex
Date: Fri, 13 Mar 2026 13:50:17 +1000 [thread overview]
Message-ID: <review-patch1-20260312195529.13002-1-rosenp@gmail.com> (raw)
In-Reply-To: <20260312195529.13002-1-rosenp@gmail.com>
Patch Review
**Correctness: OK**
The original code:
```c
if (!(pgt = kzalloc(sizeof(*pgt) + (sizeof(pgt->pte[0]) * lpte), GFP_KERNEL)))
```
is replaced with:
```c
if (!(pgt = kzalloc_flex(*pgt, pte, lpte)))
```
This is correct because:
1. `struct nvkm_vmm_pt` (defined in `vmm.h:18`) has a flexible array member `union nvkm_pte_tracker pte[]` at `vmm.h:58`, and the macro's `FAM` argument is `pte` — matching correctly.
2. `kzalloc_flex` expands to `__alloc_flex(kzalloc, default_gfp(), typeof(*pgt), pte, lpte)`, which uses `struct_size_t()` internally to compute the same `sizeof(*pgt) + sizeof(pgt->pte[0]) * lpte` size.
3. `default_gfp()` with no extra arguments resolves to `GFP_KERNEL` (via `include/linux/gfp.h:18`), matching the original explicit `GFP_KERNEL`.
4. The `__alloc_flex` macro at `slab.h:990` also handles `__counted_by()` annotation tracking if present, which is a bonus.
**Minor nit on commit message:** The commit message says "Use the proper macro do to these sizeof calculations" — there's a typo: "do to" should be "to do". Very minor, but worth fixing before applying.
**Verdict:** The patch is correct and a clean mechanical conversion. Recommend applying with the typo fix in the commit message.
---
Generated by Claude Code Patch Reviewer
next prev parent reply other threads:[~2026-03-13 3:50 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-12 19:55 [PATCH] nouveau/vmm: use kzalloc_flex Rosen Penev
2026-03-13 3:50 ` Claude Code Review Bot [this message]
2026-03-13 3:50 ` 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-20260312195529.13002-1-rosenp@gmail.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