[PATCH v2 1/3] rust: net: netlink: Migrate to zerocopy's `IntoBytes`

From
Sagar Taunk <hidden>
Date
2026-09-06 10:28:58
Also in
driver-core, lkml, rust-for-linux
Reply to
Sagar Taunk, 2026-09-06
Replace remaining imports of kernel's own `transmute::FromBytes`/`AsBytes`
traits with their zerocopy equivalent. In this case, `IntoBytes` which is
already re-exported through kernel's prelude.

Link: https://github.com/Rust-for-Linux/linux/issues/1241
Signed-off-by: Sagar Taunk <redacted>
---
 rust/kernel/net/netlink.rs | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/rust/kernel/net/netlink.rs b/rust/kernel/net/netlink.rs
index 22ef3dde36fa..c3b50dd50a4c 100644
--- a/rust/kernel/net/netlink.rs
+++ b/rust/kernel/net/netlink.rs
@@ -12,7 +12,6 @@
     alloc::{self, AllocError},
     error::to_result,
     prelude::*,
-    transmute::AsBytes,
     types::Opaque,
     ThisModule,
 };
@@ -84,7 +83,7 @@ impl GenlMsg {
     #[inline]
     fn put<T>(&mut self, attrtype: c_int, value: &T) -> Result
     where
-        T: ?Sized + AsBytes,
+        T: ?Sized + IntoBytes,
     {
         let skb = self.skb.skb.as_ptr();
         let len = size_of_val(value);
-- 
2.55.0

Thread (7 messages) 7 messages, 3 authors, last reply 2026-09-06
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help