linux-embedded-hal icon indicating copy to clipboard operation
linux-embedded-hal copied to clipboard

SPI `TransferInPlace` operation is unsound.

Open reitermarkus opened this issue 4 months ago • 0 comments

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

https://github.com/rust-embedded/linux-embedded-hal/blob/1ffb268a71b2b5157461685cc62b325a86e41f8c/src/spi.rs#L216-L222

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

reitermarkus avatar Jun 12 '25 07:06 reitermarkus