rust-for-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andreas Hindborg <a.hindborg@kernel.org>
To: "Alice Ryhl" <aliceryhl@google.com>
Cc: "Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	"Miguel Ojeda" <ojeda@kernel.org>,
	"Petr Mladek" <pmladek@suse.com>,
	"Steven Rostedt" <rostedt@goodmis.org>,
	"Andy Shevchenko" <andriy.shevchenko@linux.intel.com>,
	"Rasmus Villemoes" <linux@rasmusvillemoes.dk>,
	"Sergey Senozhatsky" <senozhatsky@chromium.org>,
	"Andrew Morton" <akpm@linux-foundation.org>,
	"Boqun Feng" <boqun.feng@gmail.com>,
	"Gary Guo" <gary@garyguo.net>,
	"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
	"Benno Lossin" <benno.lossin@proton.me>,
	"Trevor Gross" <tmgross@umich.edu>,
	"Maarten Lankhorst" <maarten.lankhorst@linux.intel.com>,
	"Maxime Ripard" <mripard@kernel.org>,
	"Thomas Zimmermann" <tzimmermann@suse.de>,
	"David Airlie" <airlied@gmail.com>,
	"Simona Vetter" <simona@ffwll.ch>,
	linux-kernel@vger.kernel.org, rust-for-linux@vger.kernel.org,
	dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 1/4] rust: fix signature of rust_fmt_argument
Date: Fri, 28 Feb 2025 10:17:30 +0100	[thread overview]
Message-ID: <87eczio2c5.fsf@kernel.org> (raw)
In-Reply-To: <CAH5fLgjKoHpGS9ugxawwJJbb68trHEVvBCCNWFcNSbScGKpuDA@mail.gmail.com> (Alice Ryhl's message of "Fri, 28 Feb 2025 09:44:21 +0100")

"Alice Ryhl" <aliceryhl@google.com> writes:

> On Fri, Feb 28, 2025 at 9:20 AM Andreas Hindborg <a.hindborg@kernel.org> wrote:
>>
>> "Alice Ryhl" <aliceryhl@google.com> writes:
>>
>> > Without this change, the rest of this series will emit the following
>> > error message:
>> >
>> > error[E0308]: `if` and `else` have incompatible types
>> >   --> <linux>/rust/kernel/print.rs:22:22
>> >    |
>> > 21 | #[export]
>> >    | --------- expected because of this
>> > 22 | unsafe extern "C" fn rust_fmt_argument(
>> >    |                      ^^^^^^^^^^^^^^^^^ expected `u8`, found `i8`
>> >    |
>> >    = note: expected fn item `unsafe extern "C" fn(*mut u8, *mut u8, *mut c_void) -> *mut u8 {bindings::rust_fmt_argument}`
>> >               found fn item `unsafe extern "C" fn(*mut i8, *mut i8, *const c_void) -> *mut i8 {print::rust_fmt_argument}`
>> >
>> > The error may be different depending on the architecture.
>> >
>> > Fixes: 787983da7718 ("vsprintf: add new `%pA` format specifier")
>> > Signed-off-by: Alice Ryhl <aliceryhl@google.com>
>> > ---
>> >  lib/vsprintf.c       | 2 +-
>> >  rust/kernel/print.rs | 8 ++++----
>> >  2 files changed, 5 insertions(+), 5 deletions(-)
>> >
>> > diff --git a/lib/vsprintf.c b/lib/vsprintf.c
>> > index 56fe96319292..a8ac4c4fffcf 100644
>> > --- a/lib/vsprintf.c
>> > +++ b/lib/vsprintf.c
>> > @@ -2285,7 +2285,7 @@ int __init no_hash_pointers_enable(char *str)
>> >  early_param("no_hash_pointers", no_hash_pointers_enable);
>> >
>> >  /* Used for Rust formatting ('%pA'). */
>> > -char *rust_fmt_argument(char *buf, char *end, void *ptr);
>> > +char *rust_fmt_argument(char *buf, char *end, const void *ptr);
>> >
>> >  /*
>> >   * Show a '%p' thing.  A kernel extension is that the '%p' is followed
>> > diff --git a/rust/kernel/print.rs b/rust/kernel/print.rs
>> > index b19ee490be58..8551631dedf1 100644
>> > --- a/rust/kernel/print.rs
>> > +++ b/rust/kernel/print.rs
>> > @@ -6,13 +6,13 @@
>> >  //!
>> >  //! Reference: <https://docs.kernel.org/core-api/printk-basics.html>
>> >
>> > -use core::{
>> > +use core::fmt;
>> > +
>> > +use crate::{
>> >      ffi::{c_char, c_void},
>> > -    fmt,
>> > +    str::RawFormatter,
>> >  };
>> >
>> > -use crate::str::RawFormatter;
>> > -
>> >  // Called from `vsprintf` with format specifier `%pA`.
>> >  #[expect(clippy::missing_safety_doc)]
>> >  #[no_mangle]
>>
>> The changes in this last hunk is not mentioned in the commit message.
>
> The diff is rendered pretty poorly, but this is just importing
> integers from crate::ffi instead of core::ffi, and I do believe that
> the commit message makes it clear that this is needed.

I see, thanks for clarifying. Consider including the clarification in
the commit message.


Best regards,
Andreas Hindborg







  reply	other threads:[~2025-02-28  9:18 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <UXTosjUFv_CKOV-K4oqNGBhMEv64tds9NgXWhHEYdCHuKM2qSPFrpBnTqhFGkcbv5_KXYERykIXhn-sYnEeuUg==@protonmail.internalid>
2025-02-27 17:01 ` [PATCH 0/4] Check Rust signatures at compile time Alice Ryhl
2025-02-27 17:01   ` [PATCH 1/4] rust: fix signature of rust_fmt_argument Alice Ryhl
2025-02-28  8:13     ` Andreas Hindborg
2025-02-28  8:44       ` Alice Ryhl
2025-02-28  9:17         ` Andreas Hindborg [this message]
2025-02-27 17:02   ` [PATCH 2/4] rust: add #[export] macro Alice Ryhl
2025-02-28  8:12     ` Andreas Hindborg
2025-02-28  9:04       ` Alice Ryhl
2025-02-28  9:24         ` Andreas Hindborg
2025-02-27 17:02   ` [PATCH 3/4] print: use new #[export] macro for rust_fmt_argument Alice Ryhl
2025-02-28  8:15     ` Andreas Hindborg
2025-02-27 17:02   ` [PATCH 4/4] panic_qr: use new #[export] macro Alice Ryhl
2025-02-27 21:28     ` Boqun Feng
2025-02-27 23:01       ` Alice Ryhl
2025-02-28  8:19     ` Andreas Hindborg
2025-02-27 19:30   ` [PATCH 0/4] Check Rust signatures at compile time Greg Kroah-Hartman
2025-02-27 23:03     ` Alice Ryhl
2025-02-28  8:47     ` Alice Ryhl
2025-02-28  7:19   ` Andreas Hindborg
2025-02-28  8:46     ` Alice Ryhl
2025-02-28  9:18       ` Andreas Hindborg
2025-02-28 12:27       ` Andy Shevchenko
2025-02-28 12:26   ` Andy Shevchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87eczio2c5.fsf@kernel.org \
    --to=a.hindborg@kernel.org \
    --cc=airlied@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=aliceryhl@google.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=benno.lossin@proton.me \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun.feng@gmail.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=gary@garyguo.net \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@rasmusvillemoes.dk \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mripard@kernel.org \
    --cc=ojeda@kernel.org \
    --cc=pmladek@suse.com \
    --cc=rostedt@goodmis.org \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=senozhatsky@chromium.org \
    --cc=simona@ffwll.ch \
    --cc=tmgross@umich.edu \
    --cc=tzimmermann@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).