Currently the dma::Coherent API provides the DmaAddress type as a typedef (type DmaAddress = bindings::dma_addr_t) only. The base address is handed out as a bare integer, so any offset arithmetic a driver does on it is unchecked.
Add a dma::Range type that couples a base dma::Address with a length and only hands out addresses and sub-ranges provably within [base, base + len). All arithmetic must be checked against both the length and overflow of the underlying dma_addr_t.
This requires submitting a proper patch to the corresponding Linux kernel mailing lists. Please remember to test your changes (including generating the documentation if changed, running the Rust doctests if changed, etc.), use a proper title for the commit, sign your commit under the Developer's Certificate of Origin and add a Suggested-by: and Link: tags to this issue. Please see https://docs.kernel.org/process/submitting-patches.html and https://rust-for-linux.com/contributing for details.
Currently the
dma::CoherentAPI provides theDmaAddresstype as a typedef (type DmaAddress = bindings::dma_addr_t) only. The base address is handed out as a bare integer, so any offset arithmetic a driver does on it is unchecked.Add a
dma::Rangetype that couples a basedma::Addresswith a length and only hands out addresses and sub-ranges provably within[base, base + len). All arithmetic must be checked against both the length and overflow of the underlyingdma_addr_t.This requires submitting a proper patch to the corresponding Linux kernel mailing lists. Please remember to test your changes (including generating the documentation if changed, running the Rust doctests if changed, etc.), use a proper title for the commit, sign your commit under the Developer's Certificate of Origin and add a Suggested-by: and Link: tags to this issue. Please see https://docs.kernel.org/process/submitting-patches.html and https://rust-for-linux.com/contributing for details.