From mboxrd@z Thu Jan 1 00:00:00 1970 From: Claude Code Review Bot To: dri-devel-reviews@example.com Subject: Claude review: rust: dma: add generalized container for types other than slices Date: Wed, 04 Mar 2026 07:03:02 +1000 Message-ID: In-Reply-To: <20260303162314.94363-3-dakr@kernel.org> References: <20260303162314.94363-1-dakr@kernel.org> <20260303162314.94363-3-dakr@kernel.org> X-Mailer: Claude Code Patch Reviewer Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit MIME-Version: 1.0 Patch Review This is the core refactoring patch. Several observations: **Typo in commit message**: "concecptually" should be "conceptually". **Vague invariant wording**: The updated invariant says: ``` /// - The size in bytes of the allocation is equal to size information via pointer. ``` This is much less precise than the original. Consider something like: "The size in bytes of the allocation is equal to `T::size(cpu_addr.as_ptr())`." **`as_mut_ptr` returns `*mut T` from `&self`**: This is intentional for DMA memory (the `#[expect(clippy::mut_from_ref)]` on `as_mut()` confirms this), but the `as_mut_ptr` method itself lacks any documentation about why `&self` suffices. A brief note on the safety rationale (same as `as_mut`) would be helpful. **Unnecessary `?` operator**: ```rust if len == 0 { Err(EINVAL)?; } ``` `return Err(EINVAL)` is more direct and idiomatic. **Dependency on `KnownSize`**: `crate::ptr::KnownSize` is imported but doesn't exist in the current tree. This is a hard dependency on unmerged work that should be noted in the cover letter. **`alloc_slice_with_attrs` overflow error code**: The original used `EOVERFLOW` for the size multiplication overflow, but the new code uses `ENOMEM`: ```rust let size = core::mem::size_of::().checked_mul(len).ok_or(ENOMEM)?; ``` `EOVERFLOW` was arguably more descriptive for an arithmetic overflow; `ENOMEM` is technically inaccurate here (it's not that memory is exhausted, it's that the requested size is invalid). --- Generated by Claude Code Patch Reviewer