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 Coherent:init() and Coherent::init_with_attrs() Date: Wed, 04 Mar 2026 07:03:02 +1000 Message-ID: In-Reply-To: <20260303162314.94363-6-dakr@kernel.org> References: <20260303162314.94363-1-dakr@kernel.org> <20260303162314.94363-6-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 **Uninitialized memory on init failure**: `alloc_with_attrs` is called without `__GFP_ZERO`, so the allocated DMA region contains arbitrary data. If `init.__init(ptr)` fails, `dmem` is dropped, which calls `dma_free_attrs`. This is safe because `Drop for Coherent` does not run `Drop` for `T`, and `T: AsBytes + FromBytes` ensures all bit patterns are valid. The safety comment correctly addresses this. **Safety comment says "self" but means "dmem"**: ```rust /// - If `__init` fails, `self` is dropped, which safely frees the underlying `Coherent`'s ``` This is a free function, not a method on an existing `self`. The comment should say "`dmem` is dropped" instead of "`self` is dropped". Otherwise clean. The distinction between `Coherent::init()` (one-shot) and `CoherentInit` (multi-stage) is well-motivated and documented in the commit message. --- Generated by Claude Code Patch Reviewer