Skip to contentSkip to conversation

FAILED: patch "[PATCH] rust: bug: update the SAFETY comment for warn_slowpath_fmt()" failed to apply to 6.18-stable tree

PATCH [email protected] 2 participants 2 messages Nov 4 – Nov 8

Subsystems (3)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

The patch below does not apply to the 6.18-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.

To reproduce the conflict and resubmit, you may use the following commands:

git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.18.y
git checkout FETCH_HEAD
git cherry-pick -x 5c94956f2bfb87025c1eaded6c51d5841d38d333
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2026110456-quartet-gondola-4267@gregkh' --subject-prefix 'PATCH 6.18.y' 'HEAD^..'

Possible dependencies:

thanks,

greg k-h

------------------ original commit in Linus's tree ------------------

From 5c94956f2bfb87025c1eaded6c51d5841d38d333 Mon Sep 17 00:00:00 2001
From: FUJITA Tomonori <[email protected]>
Date: Fri, 2 Oct 2026 19:45:50 +0900
Subject: [PATCH] rust: bug: update the SAFETY comment for warn_slowpath_fmt()
on UML

The SAFETY comment says that it is always safe to call warn_slowpath_fmt() with a valid null-terminated string. This is not true. The taint argument must also be a valid taint number. Commit 951d09ca450c ("rust: bug: pass TAINT_WARN to warn_slowpath_fmt() on UML") fixed a bug where it was not.

List each condition that the call meets: the file name, the taint number, and the null fmt.

rust/kernel/bug.rs +4 -2
index 6abed2c055b1..3b40b0bd37b5 100644
@@ -88,8 +88,10 @@ macro_rules! warn_flags {
             _ = $flags;
         }
 
-        // SAFETY: It is always safe to call `warn_slowpath_fmt()`
-        // with a valid null-terminated string.
+        // SAFETY:
+        // - The file name is a null-terminated string with `'static` lifetime.
+        // - `TAINT_WARN` is a valid taint number.
+        // - `fmt` can be NULL, and NULL is passed.
         unsafe {
             $crate::bindings::warn_slowpath_fmt(
                 $crate::str::CStrExt::as_char_ptr($crate::c_str!(::core::file!())),