[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Z92ldvI4ihlm0HJd@cassiopeiae>
Date: Fri, 21 Mar 2025 18:44:22 +0100
From: Danilo Krummrich <dakr@...nel.org>
To: kernel test robot <lkp@...el.com>
Cc: bhelgaas@...gle.com, gregkh@...uxfoundation.org, rafael@...nel.org,
ojeda@...nel.org, alex.gaynor@...il.com, boqun.feng@...il.com,
gary@...yguo.net, bjorn3_gh@...tonmail.com, benno.lossin@...ton.me,
a.hindborg@...nel.org, aliceryhl@...gle.com, tmgross@...ch.edu,
llvm@...ts.linux.dev, oe-kbuild-all@...ts.linux.dev,
linux-pci@...r.kernel.org, rust-for-linux@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 3/4] rust: pci: impl TryFrom<&Device> for &pci::Device
On Sat, Mar 22, 2025 at 12:56:58AM +0800, kernel test robot wrote:
> >> error[E0133]: use of extern static is unsafe and requires unsafe block
> --> rust/kernel/pci.rs:473:43
> |
> 473 | if dev.bus_type_raw() != addr_of!(bindings::pci_bus_type) {
> | ^^^^^^^^^^^^^^^^^^^^^^ use of extern static
> |
> = note: extern statics are not controlled by the Rust type system: invalid data, aliasing violations or data races will cause undefined behavior
This requires an unsafe block for compilers < 1.82. For compilers >= 1.82 it
turns into a warning *if* using an unsafe block.
*Not* requiring unsafe for this seems like the correct thing -- was this a
bugfix in the compiler?
I guess to make it work for all compiler versions supported by the kernel we
have to use unsafe and suppress the warning?
Powered by blists - more mailing lists