From mboxrd@z Thu Jan 1 00:00:00 1970 From: Claude Code Review Bot To: dri-devel-reviews@example.com Subject: Claude review: drm: property: use kzalloc_flex Date: Fri, 13 Mar 2026 13:43:38 +1000 Message-ID: In-Reply-To: <20260313000620.117065-1-rosenp@gmail.com> References: <20260313000620.117065-1-rosenp@gmail.com> <20260313000620.117065-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: Good** - The conversion from a separate `uint64_t *values` pointer to `uint64_t va= lues[] __counted_by(num_values)` flexible array member is valid. The struct= is only ever allocated on the heap via `drm_property_create()`, never embe= dded in another struct or placed on the stack. - The `kzalloc_flex(*property, values, num_values)` call correctly allocate= s `sizeof(struct drm_property) + num_values * sizeof(uint64_t)`. - Moving `property->num_values =3D num_values` to immediately after allocat= ion is required by `__counted_by` semantics =E2=80=94 the count field must = be set before any access to the flexible array. This is done correctly. **Cleanup correctness: Good** - Removing `kfree(property->values)` from both the error path in `drm_prope= rty_create()` and from `drm_property_destroy()` is correct since the values= are now part of the same allocation as the struct. - The `if (property->num_values)` guard before `kfree(property->values)` wa= s unnecessary even before (kfree(NULL) is safe), but removing both lines is= the right thing with the flexible array. **Minor observations:** - The original code had `if (num_values)` guarding the `kcalloc` =E2=80=94 = with `kzalloc_flex`, a `num_values` of 0 will allocate just `sizeof(struct = drm_property)` with no trailing array space, which is fine. All callers tha= t pass `num_values=3D0` never access `property->values[]`, so this is safe. - No other in-tree code assigns to `property->values` as a pointer (verifie= d via grep), so there are no missed conversion sites. No issues found. The patch is ready to merge. --- Generated by Claude Code Patch Reviewer