mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-01-01 10:43:43 +00:00
Linux kernel source tree
7643155dce
When building the rust_print sample with CONFIG_JUMP_LABEL=n, the Rust
static key support falls back to using static_key_count. This function
accepts a mutable pointer to the `struct static_key`, but the Rust
abstractions are incorrectly passing a const pointer.
This means that builds using CONFIG_JUMP_LABEL=n and SAMPLE_RUST_PRINT=y
fail with the following error message:
error[E0308]: mismatched types
--> <root>/samples/rust/rust_print_main.rs:87:5
|
87 | / kernel::declare_trace! {
88 | | /// # Safety
89 | | ///
90 | | /// Always safe to call.
91 | | unsafe fn rust_sample_loaded(magic: c_int);
92 | | }
| | ^
| | |
| |_____types differ in mutability
| arguments to this function are incorrect
|
= note: expected raw pointer `*mut kernel::bindings::static_key`
found raw pointer `*const kernel::bindings::static_key`
note: function defined here
--> <root>/rust/bindings/bindings_helpers_generated.rs:33:12
|
33 | pub fn static_key_count(key: *mut static_key) -> c_int;
| ^^^^^^^^^^^^^^^^
To fix this, insert a pointer cast so that the pointer is mutable.
Link: https://lore.kernel.org/20241118202727.73646-1-aliceryhl@google.com
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202411181440.qEdcuyh6-lkp@intel.com/
Fixes:
|
||
---|---|---|
arch | ||
block | ||
certs | ||
crypto | ||
Documentation | ||
drivers | ||
fs | ||
include | ||
init | ||
io_uring | ||
ipc | ||
kernel | ||
lib | ||
LICENSES | ||
mm | ||
net | ||
rust | ||
samples | ||
scripts | ||
security | ||
sound | ||
tools | ||
usr | ||
virt | ||
.clang-format | ||
.cocciconfig | ||
.editorconfig | ||
.get_maintainer.ignore | ||
.gitattributes | ||
.gitignore | ||
.mailmap | ||
.rustfmt.toml | ||
COPYING | ||
CREDITS | ||
Kbuild | ||
Kconfig | ||
MAINTAINERS | ||
Makefile | ||
README |
Linux kernel ============ There are several guides for kernel developers and users. These guides can be rendered in a number of formats, like HTML and PDF. Please read Documentation/admin-guide/README.rst first. In order to build the documentation, use ``make htmldocs`` or ``make pdfdocs``. The formatted documentation can also be read online at: https://www.kernel.org/doc/html/latest/ There are various text files in the Documentation/ subdirectory, several of them using the reStructuredText markup notation. Please read the Documentation/process/changes.rst file, as it contains the requirements for building and running the kernel, and information about the problems which may result by upgrading your kernel.