Skip to content

DMA: implement a dma::Range type #1248

Description

@dakr

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    device resourcesRelated to device resources, such as MMIO, IRQs, DMA, etc.easyExpected to be an easy issue to resolve.good first issueGood for newcomers

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions