lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251210112503.62925-2-mt@markoturk.info>
Date: Wed, 10 Dec 2025 12:25:51 +0100
From: Marko Turk <mt@...koturk.info>
To: dakr@...nel.org, bhelgaas@...gle.com, kwilczynski@...nel.org,
	miguel.ojeda.sandonis@...il.com, dirk.behme@...bosch.com,
	linux-pci@...r.kernel.org, linux-kernel@...r.kernel.org,
	rust-for-linux@...r.kernel.org, mt@...koturk.info
Cc: linux-pci@...r.kernel.org, linux-kernel@...r.kernel.org,
	rust-for-linux@...r.kernel.org, Marko Turk <mt@...koturk.info>
Subject: [PATCH 2/2] 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.

Signed-off-by: Marko Turk <mt@...koturk.info>
Fixes: 685376d18e9a ("samples: rust: add Rust PCI sample driver")
---
 samples/rust/rust_driver_pci.rs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/samples/rust/rust_driver_pci.rs b/samples/rust/rust_driver_pci.rs
index 5823787bea8e..fa677991a5c4 100644
--- a/samples/rust/rust_driver_pci.rs
+++ b/samples/rust/rust_driver_pci.rs
@@ -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.
-- 
2.51.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ