Re: [PATCH v9 19/29] rust: treewide: switch to the kernel `Vec` type

From: Danilo Krummrich
Date: Mon Oct 07 2024 - 11:22:10 EST


On Mon, Oct 07, 2024 at 04:34:59PM +0200, Alice Ryhl wrote:
> On Fri, Oct 4, 2024 at 5:43 PM Danilo Krummrich <dakr@xxxxxxxxxx> wrote:
> >
> > Now that we got the kernel `Vec` in place, convert all existing `Vec`
> > users to make use of it.
> >
> > Reviewed-by: Alice Ryhl <aliceryhl@xxxxxxxxxx>
> > Reviewed-by: Benno Lossin <benno.lossin@xxxxxxxxx>
> > Reviewed-by: Gary Guo <gary@xxxxxxxxxxx>
> > Signed-off-by: Danilo Krummrich <dakr@xxxxxxxxxx>
>
> This is missing the mm/kasan/kasan_test_rust.rs file, which was added
> in v6.12-rc1.

Thanks Alice for pointing this out.

diff --git a/mm/kasan/kasan_test_rust.rs b/mm/kasan/kasan_test_rust.rs
index caa7175964ef..9b222624ce47 100644
--- a/mm/kasan/kasan_test_rust.rs
+++ b/mm/kasan/kasan_test_rust.rs
@@ -11,7 +11,7 @@
/// drop the vector, and touch it.
#[no_mangle]
pub extern "C" fn kasan_test_rust_uaf() -> u8 {
- let mut v: Vec<u8> = Vec::new();
+ let mut v: KVec<u8> = KVec::new();
for _ in 0..4096 {
v.push(0x42, GFP_KERNEL).unwrap();
}

@Miguel: Can you please fix this up when you apply the series?

--

Unrelated to this series, but I think there's also a "regression" against the
lint series in this file:

warning: unsafe block missing a safety comment
--> mm/kasan/kasan_test_rust.rs:20:5
|
20 | unsafe { *ptr }
| ^^^^^^^^^^^^^^^
|
= help: consider adding a safety comment on the preceding line
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#undocumented_unsafe_blocks
= note: requested on the command line with `-W clippy::undocumented-unsafe-blocks`

warning: 1 warning emitted