Skip to content

SPI TransferInPlace operation is unsound. #120

@reitermarkus

Description

@reitermarkus

The implementation for the TransferInPlace operation violates the aliasing rule by creating an immutable reference from a mutable one, but keeping both.

SpiOperation::TransferInPlace(buf) => {
let tx = unsafe {
let p = buf.as_ptr();
std::slice::from_raw_parts(p, buf.len())
};
transfers.push(SpidevTransfer::read_write(tx, buf));
}

There needs to be a corresponding method for SpidevTransfer, e.g. read_write_in_place.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions