Skip to content

Commit e2f1081

Browse files
Marko TurkDanilo Krummrich
authored andcommitted
samples: rust: fix endianness issue in rust_driver_pci
MMIO backend of PCI Bar always assumes little-endian devices and will convert to CPU endianness automatically. Remove the u32::from_le conversion which would cause a bug on big-endian machines. Cc: stable@vger.kernel.org Reviewed-by: Dirk Behme <dirk.behme@de.bosch.com> Signed-off-by: Marko Turk <mt@markoturk.info> Fixes: 685376d ("samples: rust: add Rust PCI sample driver") Link: https://patch.msgid.link/20251210112503.62925-2-mt@markoturk.info Signed-off-by: Danilo Krummrich <dakr@kernel.org>
1 parent d893235 commit e2f1081

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

samples/rust/rust_driver_pci.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ impl SampleDriver {
4848
// Select the test.
4949
bar.write8(index.0, Regs::TEST);
5050

51-
let offset = u32::from_le(bar.read32(Regs::OFFSET)) as usize;
51+
let offset = bar.read32(Regs::OFFSET) as usize;
5252
let data = bar.read8(Regs::DATA);
5353

5454
// Write `data` to `offset` to increase `count` by one.

0 commit comments

Comments
 (0)