]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
rust: uaccess: generalize userSliceReader to support any Vec
authorFilipe Xavier <felipeaggger@gmail.com>
Tue, 7 Jan 2025 19:25:39 +0000 (16:25 -0300)
committerMiguel Ojeda <ojeda@kernel.org>
Mon, 13 Jan 2025 22:46:23 +0000 (23:46 +0100)
commitc80dd3fc45d573458bc763d599d97c82cf5dc212
tree08c7e86fe040f70391bdf459f50150021a16e0a0
parentc27e705cb2b71769dbb4bb1bee1920d2fa01a597
rust: uaccess: generalize userSliceReader to support any Vec

The UserSliceReader::read_all function is currently restricted to use
only Vec with the kmalloc allocator. However, there is no reason for
this limitation.

This patch generalizes the function to accept any Vec regardless of the
allocator used.

There's a use-case for a KVVec in Binder to avoid maximum sizes for a
certain array.

Link: https://github.com/Rust-for-Linux/linux/issues/1136
Signed-off-by: Filipe Xavier <felipeaggger@gmail.com>
Reviewed-by: Alice Ryhl <aliceryhl@google.com>
Reviewed-by: Boqun Feng <boqun.feng@gmail.com>
Link: https://lore.kernel.org/r/20250107-gen-userslice-readall-alloc-v2-1-d7fe4d19241a@gmail.com
[ Reflowed and slightly reworded title. - Miguel ]
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
rust/kernel/uaccess.rs