Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 10FCDC636D4 for ; Wed, 15 Feb 2023 17:55:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229631AbjBORzP (ORCPT ); Wed, 15 Feb 2023 12:55:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55946 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229570AbjBORzN (ORCPT ); Wed, 15 Feb 2023 12:55:13 -0500 Received: from mail-0301.mail-europe.com (mail-0301.mail-europe.com [188.165.51.139]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E2F681BAC6 for ; Wed, 15 Feb 2023 09:55:10 -0800 (PST) Date: Wed, 15 Feb 2023 17:55:03 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail3; t=1676483705; x=1676742905; bh=/JN56BWgCEKzWRC08wYWK2eiKTWpvLNmRreZjnISt60=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID:BIMI-Selector; b=RYCzRgDdFIT7zHrcZblr68yaiCoYd260RO97y9EmP4A0bHVdDp3CinvOU9KbwmUEM WmlDnIea4WhuhH098w8ocrTB/DedyoWJDwwJc7OY/AkpW743hf492u7iDKc4cu9ZI9 Xp29OdBixhjN+k7FzsH/hWmmMhB9hbE9qEBswx6hlEFSiy6KUZaU+VSKbMeogQWJzO iPX04bfhw6/yK61bXU3JpDyX2vweT9xrvTzBCI6Rl6bk/dvaGuGwHzMHRp+l++xw5e 9qp3dPgg+XFkImY9tQlWg+9mpe6irDTN3w2+JsKqvQTlG2syHe7MTAhXfmf5vlO8tO jyaot0ldHGz9w== To: David Gow From: =?utf-8?Q?Bj=C3=B6rn_Roy_Baron?= Cc: Miguel Ojeda , Alex Gaynor , Wedson Almeida Filho , Boqun Feng , Gary Guo , rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: Re: [PATCH] rust: kernel: Mark rust_fmt_argument as extern "C" Message-ID: In-Reply-To: <20230214224735.264894-1-davidgow@google.com> References: <20230214224735.264894-1-davidgow@google.com> Feedback-ID: 27884398:user:proton MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tuesday, February 14th, 2023 at 23:47, David Gow w= rote: > The rust_fmt_argument function is called from printk() to handle the %pA > format specifier. >=20 > Since it's called from C, we should mark it extern "C" to make sure it's > ABI compatible. >=20 > Cc: stable@vger.kernel.org > Fixes: 247b365dc8dc ("rust: add `kernel` crate") > Signed-off-by: David Gow davidgow@google.com Reviewed-by: Bj=C3=B6rn Roy Baron >=20 > --- >=20 > See discussion in: > https://github.com/Rust-for-Linux/linux/pull/967 > and > https://github.com/Rust-for-Linux/linux/pull/966 >=20 > --- > rust/kernel/print.rs | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) >=20 > diff --git a/rust/kernel/print.rs b/rust/kernel/print.rs > index 30103325696d..ec457f0952fe 100644 > --- a/rust/kernel/print.rs > +++ b/rust/kernel/print.rs > @@ -18,7 +18,7 @@ use crate::bindings; >=20 > // Called from `vsprintf` with format specifier `%pA`. > #[no_mangle] > -unsafe fn rust_fmt_argument(buf: *mut c_char, end: *mut c_char, ptr: *co= nst c_void) -> *mut c_char { > +unsafe extern "C" fn rust_fmt_argument(buf: *mut c_char, end: *mut c_cha= r, ptr: *const c_void) -> *mut c_char { > use fmt::Write; > // SAFETY: The C contract guarantees that `buf` is valid if it's les= s than `end`. > let mut w =3D unsafe { RawFormatter::from_ptrs(buf.cast(), end.cast(= )) }; > -- > 2.39.1.581.gbfd45094c4-goog