We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see ourdocumentation.
There was an error while loading.Please reload this page.
2 parentse50b26d +e3f5643 commitf7c8c94Copy full SHA for f7c8c94
.github/workflows/ci.yml
@@ -37,6 +37,9 @@ jobs:
37
toolchain:${{ matrix.rust }}
38
target:${{ matrix.target }}
39
40
+ -if:${{ matrix.rust=='1.65.0' }}
41
+run:cargo update --precise 2.0.106 --package syn
42
+
43
-name:Install armv7 libraries
44
if:${{ matrix.target == 'armv7-unknown-linux-gnueabihf' }}
45
run:|
CHANGELOG.md
@@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
7
8
##[Unreleased]
9
10
+##[v0.4.1] - 2025-11-06
11
12
+###Fixed
13
14
+- Fix UB (and remove unsafe block) in handling of SpiOperation::TransferInPlace
15
16
##[v0.4.0] - 2024-01-10
17
18
###Changed
@@ -152,7 +158,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
152
158
153
159
Initial release
154
160
155
-[Unreleased]:https://github.com/rust-embedded/linux-embedded-hal/compare/v0.4.0...HEAD
161
+[Unreleased]:https://github.com/rust-embedded/linux-embedded-hal/compare/v0.4.1...HEAD
162
+[v0.4.1]:https://github.com/rust-embedded/linux-embedded-hal/compare/v0.4.0...v0.4.1
156
163
[v0.4.0]:https://github.com/rust-embedded/linux-embedded-hal/compare/v0.4.0-alpha.4...v0.4.0
157
164
[v0.4.0-alpha.4]:https://github.com/rust-embedded/linux-embedded-hal/compare/v0.4.0-alpha.3...v0.4.0-alpha.4
165
[v0.4.0-alpha.3]:https://github.com/rust-embedded/linux-embedded-hal/compare/v0.4.0-alpha.2...v0.4.0-alpha.3
Cargo.toml
@@ -9,7 +9,7 @@ keywords = ["Linux", "hal"]
license ="MIT OR Apache-2.0"
name ="linux-embedded-hal"
repository ="https://github.com/rust-embedded/linux-embedded-hal"
-version ="0.4.0"
+version ="0.4.1"
edition ="2018"
[features]
@@ -29,7 +29,7 @@ sysfs_gpio = { version = "0.6.1", optional = true }
29
i2cdev = {version ="0.6.0",optional =true }
30
nb ="1"
31
serialport = {version ="4.2.0",default-features =false }
32
-spidev = {version ="0.6.0",optional =true }
+spidev = {version ="0.6.1",optional =true }
33
nix ="0.27.1"
34
35
[dev-dependencies]
src/spi.rs
@@ -173,9 +173,8 @@ mod embedded_hal_impl {
173
}
174
175
fntransfer_in_place(&mutself,words:&mut[u8]) ->Result<(),Self::Error>{
176
-let tx = words.to_owned();
177
self.0
178
-.transfer(&mutSpidevTransfer::read_write(&tx,words))
+.transfer(&mutSpidevTransfer::read_write_in_place(words))
179
.map_err(|err|SPIError{ err})
180
181
@@ -214,11 +213,7 @@ mod embedded_hal_impl {
214
213
215
},
216
SpiOperation::TransferInPlace(buf) =>{
217
-let tx =unsafe{
218
-let p = buf.as_ptr();
219
- std::slice::from_raw_parts(p, buf.len())
220
-};
221
- transfers.push(SpidevTransfer::read_write(tx, buf));
+ transfers.push(SpidevTransfer::read_write_in_place(buf));
222
223
SpiOperation::DelayNs(ns) =>{
224
let us ={