Patch "rust: kernel: Mark rust_fmt_argument as extern "C"" has been added to the 6.2-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    rust: kernel: Mark rust_fmt_argument as extern "C"

to the 6.2-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     rust-kernel-mark-rust_fmt_argument-as-extern-c.patch
and it can be found in the queue-6.2 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.


>From c682e4c37d2b8ba3bde1125cbbea4ee88824b4e2 Mon Sep 17 00:00:00 2001
From: David Gow <davidgow@xxxxxxxxxx>
Date: Wed, 15 Feb 2023 06:47:35 +0800
Subject: rust: kernel: Mark rust_fmt_argument as extern "C"
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

From: David Gow <davidgow@xxxxxxxxxx>

commit c682e4c37d2b8ba3bde1125cbbea4ee88824b4e2 upstream.

The rust_fmt_argument function is called from printk() to handle the %pA
format specifier.

Since it's called from C, we should mark it extern "C" to make sure it's
ABI compatible.

Cc: stable@xxxxxxxxxxxxxxx
Fixes: 247b365dc8dc ("rust: add `kernel` crate")
Signed-off-by: David Gow <davidgow@xxxxxxxxxx>
Reviewed-by: Gary Guo <gary@xxxxxxxxxxx>
Reviewed-by: Björn Roy Baron <bjorn3_gh@xxxxxxxxxxxxxx>
Reviewed-by: Vincenzo Palazzo <vincenzopalazzodev@xxxxxxxxx>
[Applied `rustfmt`]
Signed-off-by: Miguel Ojeda <ojeda@xxxxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
---
 rust/kernel/print.rs |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

--- a/rust/kernel/print.rs
+++ b/rust/kernel/print.rs
@@ -18,7 +18,11 @@ use crate::bindings;
 
 // Called from `vsprintf` with format specifier `%pA`.
 #[no_mangle]
-unsafe fn rust_fmt_argument(buf: *mut c_char, end: *mut c_char, ptr: *const c_void) -> *mut c_char {
+unsafe extern "C" fn rust_fmt_argument(
+    buf: *mut c_char,
+    end: *mut c_char,
+    ptr: *const c_void,
+) -> *mut c_char {
     use fmt::Write;
     // 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()) };


Patches currently in stable-queue which might be from davidgow@xxxxxxxxxx are

queue-6.2/drm-buddy_allocator-fix-buddy-allocator-init-on-32-b.patch
queue-6.2/drm-test-fix-32-bit-issue-in-drm_buddy_test.patch
queue-6.2/rust-kernel-mark-rust_fmt_argument-as-extern-c.patch



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux