rust/kernel/list.rs | 2 ++ rust/kernel/print.rs | 1 - 2 files changed, 2 insertions(+), 1 deletion(-)
Replace remaining "SAFETY: TODO" comments with proper explanations.
Document why the raw pointer cast to `fmt::Arguments` is valid
and clarify the invariants required when calling `_printk`
through FFI.
This does not change behaviour.
v2:
- Fix rustfmt formatting issue reported by 0-day CI.
- Remove extra blank line before unsafe block.
Signed-off-by: Ali Zain <alizainuimx@gmail.com>
---
rust/kernel/list.rs | 2 ++
rust/kernel/print.rs | 1 -
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/rust/kernel/list.rs b/rust/kernel/list.rs
index 0d8a201f2..65d33957e 100644
--- a/rust/kernel/list.rs
+++ b/rust/kernel/list.rs
@@ -589,6 +589,8 @@ pub unsafe fn remove(&mut self, item: &T) -> Option<ListArc<T, ID>> {
// or in this list (with the same `ID`).
// - We hold `&mut self`, so there is no concurrent mutation of
// the link fields.
+ // - `T::view_links(item)` returns the embedded link fields for this
+ // object, which remain valid for the lifetime of `item`.
let mut item = unsafe { ListLinks::fields(T::view_links(item)) };
// SAFETY: The user provided a reference, and reference are never dangling.
diff --git a/rust/kernel/print.rs b/rust/kernel/print.rs
index 2ae7b4ce9..c3edc0ab3 100644
--- a/rust/kernel/print.rs
+++ b/rust/kernel/print.rs
@@ -112,7 +112,6 @@ pub unsafe fn call_printk(
// at compile time, a null-terminated module name, and a pointer to
// `fmt::Arguments` obtained via `core::ptr::from_ref`. All pointers
// are valid for the duration of the call and respect the C ABI.
-
unsafe {
bindings::_printk(
format_string.as_ptr(),
--
2.53.0
On Fri, Feb 13, 2026 at 6:31 AM Ali Zain <alizainuimx@gmail.com> wrote: > > Replace remaining "SAFETY: TODO" comments with proper explanations. > > Document why the raw pointer cast to `fmt::Arguments` is valid > and clarify the invariants required when calling `_printk` > through FFI. > > This does not change behaviour. > > v2: > - Fix rustfmt formatting issue reported by 0-day CI. > - Remove extra blank line before unsafe block. > > Signed-off-by: Ali Zain <alizainuimx@gmail.com> Since this is meant to be v2, please mark your patch as v2 using flags like `git format-patch -v2`. What is the base for this patch, by the way? Also, you included the changelog within the commit message -- they usually go after the first `---` line, so that it is not included. There is also an unrelated change in `print.rs`. I hope that helps. Cheers, Miguel
© 2016 - 2026 Red Hat, Inc.