From mboxrd@z Thu Jan 1 00:00:00 1970 From: Claude Code Review Bot To: dri-devel-reviews@example.com Subject: Claude review: udmabuf: Do not create malformed scatterlists Date: Sat, 14 Mar 2026 06:43:42 +1000 Message-ID: In-Reply-To: <0-v1-42779f29381a+4b9-udmabuf_sg_jgg@nvidia.com> References: <0-v1-42779f29381a+4b9-udmabuf_sg_jgg@nvidia.com> X-Mailer: Claude Code Patch Reviewer Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit MIME-Version: 1.0 Overall Series Review Subject: udmabuf: Do not create malformed scatterlists Author: Jason Gunthorpe Patches: 1 Reviewed: 2026-03-14T06:43:42.305622 --- This is a single-patch fix from Jason Gunthorpe that addresses a real bug in the udmabuf driver where `sg_set_folio()` was used in a per-4K-page loop, producing malformed scatterlists. The root cause is twofold: (1) `sg_set_folio()` doesn't handle offsets larger than `PAGE_SIZE` correctly, and (2) the code failed to coalesce physically contiguous pages into single scatterlist entries, which the scatterlist API expects. The fix is clean and straightforward: revert to storing an array of `struct page *` (tail pages from the folios) instead of `struct folio **` plus a parallel offsets array, and use `sg_alloc_table_from_pages()` which naturally builds a correct, coalesced scatterlist from a page array. The patch simplifies the code significantly (-36, +13 lines), removes the `offsets` array entirely, and eliminates a temporary page-array allocation in `vmap_udmabuf()` since the pages are now stored directly. The approach is sound and the resulting code is cleaner than what it replaces. **Verdict: Looks good. This is a well-motivated bugfix with a clean implementation.** --- Generated by Claude Code Patch Reviewer