Re: [PATCH 6.1 000/205] 6.1.134-rc2 review
From: Miguel Ojeda
Date: Wed Apr 09 2025 - 12:17:17 EST
On Wed, 09 Apr 2025 14:02:32 +0200 Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> wrote:
>
> This is the start of the stable review cycle for the 6.1.134 release.
> There are 205 patches in this series, all will be posted as a response
> to this one. If anyone has any issues with these being applied, please
> let me know.
>
> Responses should be made by Fri, 11 Apr 2025 11:58:02 +0000.
> Anything received after that time might be too late.
For 6.1.y and 6.6.y, Rust fails to build with:
error[E0432]: unresolved import `crate::ffi`
--> rust/kernel/print.rs:10:5
|
10 | ffi::{c_char, c_void},
| ^^^
| |
| unresolved import
| help: a similar path exists: `core::ffi`
In 6.1.y, C `char` and `core::ffi::c_char` are both signed. So the only issue is
the `const` -- we can keep using the `core::ffi::c_char` type.
In 6.6.y, C `char` changed to unsigned, but `core::ffi::c_char` is signed.
Either way, for both branches, I would recommend dropping the patch -- it is not
critical, and we can always send it later.
Thus, for 6.1.y we could just drop the `rust/kernel/print.rs` changes. And for
6.6.y we would need something like:
diff --git a/rust/kernel/print.rs b/rust/kernel/print.rs
index f48926e3e9fe..c85b9b4922a0 100644
--- a/rust/kernel/print.rs
+++ b/rust/kernel/print.rs
@@ -6,10 +6,7 @@
//!
//! Reference: <https://www.kernel.org/doc/html/latest/core-api/printk-basics.html>
-use core::{
- ffi::{c_char, c_void},
- fmt,
-};
+use core::{ffi::c_void, fmt};
use crate::str::RawFormatter;
@@ -18,11 +15,7 @@
// Called from `vsprintf` with format specifier `%pA`.
#[no_mangle]
-unsafe extern "C" 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 u8, end: *mut u8, ptr: *const c_void) -> *mut u8 {
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()) };
Thanks!
Cheers,
Miguel