Replace the kernel's own `transmute::FromBytes` and `AsBytes` traits
with their zerocopy equivalents. Specifically, this updates
`GenlMsg::put` to rely on `IntoBytes` for converting attributes into
byte slices.
Also, add `Immutable` trait bound on `GenlMsg::put` as zerocopy
splits the `no interior mutability` guarantee that `AsBytes` bundled
together.
Link: https://github.com/Rust-for-Linux/linux/issues/1241
Signed-off-by: Sagar Taunk <redacted>
Reviewed-by: Alexandre Courbot <acourbot@nvidia.com>
---
Changes Since V2: Follow vertical import style as told by Alexandre Courbot.
No functional changes.
rust/kernel/net/netlink.rs | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
From: Alice Ryhl <aliceryhl@google.com> Date: 2026-09-17 09:33:04
On Tue, Sep 15, 2026 at 02:42:44PM +0000, Sagar Taunk wrote:
Replace the kernel's own `transmute::FromBytes` and `AsBytes` traits
with their zerocopy equivalents. Specifically, this updates
`GenlMsg::put` to rely on `IntoBytes` for converting attributes into
byte slices.
Also, add `Immutable` trait bound on `GenlMsg::put` as zerocopy
splits the `no interior mutability` guarantee that `AsBytes` bundled
together.
Link: https://github.com/Rust-for-Linux/linux/issues/1241
Signed-off-by: Sagar Taunk <redacted>
Reviewed-by: Alexandre Courbot <acourbot@nvidia.com>
Thanks, this change is ok with me.
Reviewed-by: Alice Ryhl <aliceryhl@google.com>
Can you send this to the net folks? Please update your patch title to
[PATCH net-next vX] according to the guidelines outlined in:
Documentation/process/maintainer-netdev.rst
Alice
Hello:
This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski [off-list ref]:
On Tue, 15 Sep 2026 14:42:44 +0000 you wrote:
Replace the kernel's own `transmute::FromBytes` and `AsBytes` traits
with their zerocopy equivalents. Specifically, this updates
`GenlMsg::put` to rely on `IntoBytes` for converting attributes into
byte slices.
Also, add `Immutable` trait bound on `GenlMsg::put` as zerocopy
splits the `no interior mutability` guarantee that `AsBytes` bundled
together.
[...]