Commit e2f1081c authored by Marko Turk's avatar Marko Turk Committed by Danilo Krummrich
Browse files

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: default avatarDirk Behme <dirk.behme@de.bosch.com>
Signed-off-by: default avatarMarko Turk <mt@markoturk.info>
Fixes: 685376d1 ("samples: rust: add Rust PCI sample driver")
Link: https://patch.msgid.link/20251210112503.62925-2-mt@markoturk.info


Signed-off-by: default avatarDanilo Krummrich <dakr@kernel.org>
parent d8932355
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -48,7 +48,7 @@ fn testdev(index: &TestIndex, bar: &Bar0) -> Result<u32> {
        // Select the test.
        bar.write8(index.0, Regs::TEST);

        let offset = u32::from_le(bar.read32(Regs::OFFSET)) as usize;
        let offset = bar.read32(Regs::OFFSET) as usize;
        let data = bar.read8(Regs::DATA);

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