From: Claude Code Review Bot <claude-review@example.com>
To: dri-devel-reviews@example.com
Subject: Claude review: drm: property: use kzalloc_flex
Date: Fri, 13 Mar 2026 13:43:38 +1000 [thread overview]
Message-ID: <review-patch1-20260313000620.117065-1-rosenp@gmail.com> (raw)
In-Reply-To: <20260313000620.117065-1-rosenp@gmail.com>
Patch Review
**Correctness: Good**
- The conversion from a separate `uint64_t *values` pointer to `uint64_t values[] __counted_by(num_values)` flexible array member is valid. The struct is only ever allocated on the heap via `drm_property_create()`, never embedded in another struct or placed on the stack.
- The `kzalloc_flex(*property, values, num_values)` call correctly allocates `sizeof(struct drm_property) + num_values * sizeof(uint64_t)`.
- Moving `property->num_values = num_values` to immediately after allocation is required by `__counted_by` semantics — 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_property_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)` was 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` — 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 that pass `num_values=0` never access `property->values[]`, so this is safe.
- No other in-tree code assigns to `property->values` as a pointer (verified via grep), so there are no missed conversion sites.
No issues found. The patch is ready to merge.
---
Generated by Claude Code Patch Reviewer
prev parent reply other threads:[~2026-03-13 3:43 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-13 0:06 [PATCH] drm: property: use kzalloc_flex Rosen Penev
2026-03-13 3:43 ` Claude review: " Claude Code Review Bot
2026-03-13 3:43 ` Claude Code Review Bot [this message]
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-20260313000620.117065-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