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/amdkfd: convert CRIU event-private allocation to kvcalloc() Date: Thu, 04 Jun 2026 13:42:10 +1000 Message-ID: In-Reply-To: <20260601195510.639318-1-william@theesfeld.net> References: <20260601195510.639318-1-william@theesfeld.net> <20260601195510.639318-1-william@theesfeld.net> X-Mailer: Claude Code Patch Reviewer Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Patch Review **Status: Clean / No issues** The change at `drivers/gpu/drm/amd/amdkfd/kfd_events.c:551`: ```c - ev_privs =3D kvzalloc(num_events * sizeof(*ev_privs), GFP_KERNEL); + ev_privs =3D kvcalloc(num_events, sizeof(*ev_privs), GFP_KERNEL); ``` **Correctness:** - `kvcalloc(n, size, flags)` is functionally equivalent to `kvzalloc(n * si= ze, flags)` but with overflow protection. Both zero the allocated memory. T= he semantics are preserved. - `num_events` is a `uint32_t` and `sizeof(*ev_privs)` is a `size_t`, so th= e multiplication *could* overflow on 32-bit platforms with a sufficiently l= arge `num_events` value. In practice `num_events` comes from `kfd_get_num_e= vents()` which counts IDR entries, so it's bounded by resource limits, but = the overflow-safe API is still the right thing to use. - The `kvfree()` at line 603 remains correct for memory allocated by either= `kvzalloc` or `kvcalloc`. **Observation:** Lines 595 and 601 still use `num_events * sizeof(*ev_privs= )` in the open-coded form (for `copy_to_user` and the offset bump). These a= re not allocation calls so `kvcalloc` doesn't apply, but if the author want= ed to be thorough about overflow protection, those multiplications could al= so use `size_mul()`. This is not a blocker =E2=80=94 it's a separate concer= n and arguably overkill for a size that was already validated at allocation= time. **Commit message:** Accurate and well-written. Correctly notes "no function= al change." Reviewed-by: would be appropriate here. --- Generated by Claude Code Patch Reviewer