Re: [PATCH v2] rust: dma: return zero for Coherent reads past EOF
"Alexandre Courbot" <[email protected]> Sat, 01 Aug 2026 15:01:48 +0900
| Newsgroups | dev.linux.lists.driver-core,org.kernel.vger.linux-kernel,org.kernel.vger.rust-for-linux,org.kernel.vger.stable |
|---|---|
| Message-ID | <[email protected]> |
On Fri Jul 31, 2026 at 1:34 AM JST, Younes Akhouayri via B4 Relay wrote: > From: Younes Akhouayri <[email protected]> > > Coherent<T>::write_to_slice() calculates a zero-byte copy when the file > offset is beyond the allocation, but still calls > UserSliceWriter::write_dma(). The latter rejects offsets beyond the > allocation even when the copy length is zero, so a debugfs read past EOF > returns -ERANGE. > > Return before calling write_dma() when the offset is at or beyond the > allocation, matching simple_read_from_buffer() EOF semantics. > > Fixes: 016818513936 ("rust: dma: implement BinaryWriter for Coherent<[u8]= >") > Cc: [email protected] > Link: https://rust-for-linux.zulipchat.com/#narrow/channel/291566-Library= /topic/.E2.9C.94.20Possible.20past-EOF.20bug.20in.20Coherent.3CT.3E.3A.3Awr= ite_to_slice/near/611677095 > Signed-off-by: Younes Akhouayri <[email protected]> Reviewed-by: Alexandre Courbot <[email protected]>