[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <cac484ba-904b-447d-b802-3e324c843ffe@gmail.com>
Date: Wed, 10 Dec 2025 15:10:12 +0100
From: Dirk Behme <dirk.behme@...il.com>
To: Marko Turk <mt@...koturk.info>, 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
Subject: Re: [PATCH 2/2] samples: rust: fix endianness issue in
rust_driver_pci
On 10.12.25 12:25, Marko Turk wrote:
> 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;
Yes, dropping from_le() is what we talked about:
Reviewed-by: Dirk Behme <dirk.behme@...bosch.com>
Thanks
Dirk
P.S.: I'm not sure if the `Fixes` is required: As far as I understood
there are no big-endian machines supported by Rust, yet. On all other
supported little-endian machines this is a no-op. So I think it is at
least debatable if this is a "bug" which needs back porting.
Powered by blists - more mailing lists