[PATCH] rust: document safety requirements for fmt::Arguments dereference
From: Riccardo
Date: Sat Dec 20 2025 - 04:43:44 EST
Signed-off-by: Riccardo <riccioadami@xxxxxxxxx>
---
rust/kernel/print.rs | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/rust/kernel/print.rs b/rust/kernel/print.rs
index 899bed9c08fd..5f54be97a6a0 100644
--- a/rust/kernel/print.rs
+++ b/rust/kernel/print.rs
@@ -25,10 +25,10 @@
// SAFETY: The C contract guarantees that `buf` is valid if it's less than `end`.
let mut w = unsafe { RawFormatter::from_ptrs(buf.cast(), end.cast()) };
//SAFETY: `ptr` is provided by the kernel formatting path for the `%pA`
-// specifier during `vsnprintf` processing and always points to a valid
-// `fmt::Arguments` value created by the caller. The value lives at least
-// for the duration of this call and is only read here. It is not stored
-// or accessed after returning, so dereferencing it is safe.
+ // specifier during `vsnprintf` processing and always points to a valid
+ // `fmt::Arguments` value created by the caller. The value lives at least
+ // for the duration of this call and is only read here. It is not stored
+ // or accessed after returning, so dereferencing it is safe.
let _ = w.write_fmt(unsafe { *ptr.cast::<fmt::Arguments<'_>>() });
w.pos().cast()
--
2.52.0