linux-kernelorg-stable/rust/kernel
Miguel Ojeda a0d2e6f9d3 rust: alloc: fix `rusttest` by providing `Cmalloc::aligned_layout` too
[ Upstream commit 0f580d5d3d ]

Commit fde578c862 ("rust: alloc: replace aligned_size() with
Kmalloc::aligned_layout()") provides a public `aligned_layout` function
in `Kamlloc`, but not in `Cmalloc`, and thus uses of it will trigger an
error in `rusttest`.

Such a user appeared in the following commit 22ab0641b9 ("rust: drm:
ensure kmalloc() compatible Layout"):

    error[E0599]: no function or associated item named `aligned_layout` found for struct `alloc::allocator_test::Cmalloc` in the current scope
       --> rust/kernel/drm/device.rs💯31
        |
    100 |         let layout = Kmalloc::aligned_layout(Layout:🆕:<Self>());
        |                               ^^^^^^^^^^^^^^ function or associated item not found in `Cmalloc`
        |
       ::: rust/kernel/alloc/allocator_test.rs:19:1
        |
    19  | pub struct Cmalloc;
        | ------------------ function or associated item `aligned_layout` not found for this struct

Thus add an equivalent one for `Cmalloc`.

Fixes: fde578c862 ("rust: alloc: replace aligned_size() with Kmalloc::aligned_layout()")
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
Link: https://lore.kernel.org/r/20250816204215.2719559-1-ojeda@kernel.org
Signed-off-by: Danilo Krummrich <dakr@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2025-08-28 16:31:13 +02:00
..
alloc rust: alloc: fix `rusttest` by providing `Cmalloc::aligned_layout` too 2025-08-28 16:31:13 +02:00
block rust: use custom FFI integer types 2025-03-13 13:01:49 +01:00
init rust: init: allow `dead_code` warnings for Rust >= 1.89.0 2025-07-17 18:37:14 +02:00
list
net rust: use custom FFI integer types 2025-03-13 13:01:49 +01:00
sync rust: use custom FFI integer types 2025-03-13 13:01:49 +01:00
alloc.rs
block.rs
build_assert.rs
device.rs
error.rs rust: error: add missing newline to pr_warn! calls 2025-03-22 12:54:26 -07:00
firmware.rs rust: firmware: Use `ffi::c_char` type in `FwFunc` 2025-05-02 07:59:06 +02:00
init.rs rust: init: add missing newline to pr_info! calls 2025-03-22 12:54:26 -07:00
ioctl.rs
kunit.rs
lib.rs rust: use `#[used(compiler)]` to fix build and `modpost` with Rust >= 1.89.0 2025-07-24 08:56:37 +02:00
list.rs rust: allow Rust 1.87.0's `clippy::ptr_eq` lint 2025-05-18 08:24:57 +02:00
net.rs
page.rs
prelude.rs
print.rs rust: fix signature of rust_fmt_argument 2025-04-10 14:39:20 +02:00
rbtree.rs
sizes.rs
static_assert.rs
std_vendor.rs
str.rs rust: clean Rust 1.88.0's `clippy::uninlined_format_args` lint 2025-05-18 08:24:57 +02:00
sync.rs rust: lockdep: Remove support for dynamically allocated LockClassKeys 2025-03-22 12:54:22 -07:00
task.rs rust: use custom FFI integer types 2025-03-13 13:01:49 +01:00
time.rs rust: use custom FFI integer types 2025-03-13 13:01:49 +01:00
types.rs rust: use custom FFI integer types 2025-03-13 13:01:49 +01:00
uaccess.rs rust: map `long` to `isize` and `char` to `u8` 2025-03-13 13:02:13 +01:00
workqueue.rs