From mboxrd@z Thu Jan 1 00:00:00 1970 From: Claude Code Review Bot To: dri-devel-reviews@example.com Subject: Claude review: nouveau/vmm: use kzalloc_flex Date: Fri, 13 Mar 2026 13:50:17 +1000 Message-ID: In-Reply-To: <20260312195529.13002-1-rosenp@gmail.com> References: <20260312195529.13002-1-rosenp@gmail.com> <20260312195529.13002-1-rosenp@gmail.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: OK** The original code: ```c if (!(pgt =3D kzalloc(sizeof(*pgt) + (sizeof(pgt->pte[0]) * lpte), GFP_KERN= EL))) ``` is replaced with: ```c if (!(pgt =3D 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` argume= nt is `pte` =E2=80=94 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 s= ame `sizeof(*pgt) + sizeof(pgt->pte[0]) * lpte` size. 3. `default_gfp()` with no extra arguments resolves to `GFP_KERNEL` (via `i= nclude/linux/gfp.h:18`), matching the original explicit `GFP_KERNEL`. 4. The `__alloc_flex` macro at `slab.h:990` also handles `__counted_by()` a= nnotation tracking if present, which is a bonus. **Minor nit on commit message:** The commit message says "Use the proper ma= cro do to these sizeof calculations" =E2=80=94 there's a typo: "do to" shou= ld be "to do". Very minor, but worth fixing before applying. **Verdict:** The patch is correct and a clean mechanical conversion. Recomm= end applying with the typo fix in the commit message. --- Generated by Claude Code Patch Reviewer