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/gem/shmem: Introduce __drm_gem_shmem_free_sgt_locked() Date: Thu, 04 Jun 2026 16:06:44 +1000 Message-ID: In-Reply-To: <20260529183702.677677-6-lyude@redhat.com> References: <20260529183702.677677-1-lyude@redhat.com> <20260529183702.677677-6-lyude@redhat.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 **Status: Two issues to flag** **Issue 1 =E2=80=94 kdoc name mismatch**: The kernel-doc comment names the = function `__drm_gem_shmem_release_sgt_locked` but the actual function is `_= _drm_gem_shmem_free_sgt_locked`: ```c +/** + * __drm_gem_shmem_release_sgt_locked - Unpin and DMA unmap pages, and rel= ease the ``` vs. ```c +void __drm_gem_shmem_free_sgt_locked(struct drm_gem_shmem_object *shmem) ``` The V10 changelog says "Fix incorrect function name in documentation" but t= he mismatch is still present. **Issue 2 =E2=80=94 No NULL check on `shmem->sgt`**: The new exported funct= ion does not check for `shmem->sgt =3D=3D NULL` before dereferencing: ```c +void __drm_gem_shmem_free_sgt_locked(struct drm_gem_shmem_object *shmem) +{ + dma_resv_assert_held(shmem->base.resv); + + dma_unmap_sgtable(shmem->base.dev->dev, shmem->sgt, DMA_BIDIRECTIONAL, 0); ``` Both callers currently guard against this (the C side with `if (shmem->sgt)= `, the Rust side via SGTableMap type invariants). However, since this is `E= XPORT_SYMBOL_GPL` and documented as callable by drivers (specifically the R= ust bindings), a defensive NULL check with early return or `WARN_ON` would = be prudent. If a future caller misuses this, it will be a NULL pointer dere= ference in kernel context. **Note on the kdoc**: The description says "Unpin and DMA unmap pages" but = the function doesn't actually unpin pages (it doesn't call `drm_gem_shmem_p= ut_pages_locked()`). It only unmaps the SGTable and frees it. The "unpin" c= laim is inaccurate. --- Generated by Claude Code Patch Reviewer