From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id ADECD263C90; Tue, 8 Apr 2025 11:22:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744111363; cv=none; b=PrXA5YBXxGZoHRwMRso4RskodD4f7qwQ1INK21IfvTrQUfU1P5MpzU/XrnXYer3LI5cJIiLg+OqSe1T3FeYhOMo+BSumna2Nr/WGmrANi4POTrpaHrdDOoLXkYfZEmFN/U+TrwNr/+efv6zTOq4mGbK577IbqOIoKxWQxAzu5g0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744111363; c=relaxed/simple; bh=pZEEnhs7QTu6b+vxxhjPc3HnFeKz52jpfIUQJ7CJIw4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=GMnecfEH/M+g7uiNTDDQWgqHwU1VKt4M8pRL6Y2okZ7hsxKIBa9bzduKiWcIO8tDaccdma6c6vwrS7bzdDHQU+Ug5tmiHdfx1NEafpVPADE3tweiCqgo9kZ3QK5h3l8Aj0eJCoOzW9O6HBlY2hOPydIqG9TX/JPF5DzzbPTwN/g= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=tdilaRxj; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="tdilaRxj" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3D4EBC4CEE5; Tue, 8 Apr 2025 11:22:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1744111363; bh=pZEEnhs7QTu6b+vxxhjPc3HnFeKz52jpfIUQJ7CJIw4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tdilaRxjXDi2ng7e0HJz0VXG0B5ZpGMPh3qkEHR+2bT3gcJddCkkRdBeQ/20lTa2T aeo6LWQN10YKhh5mO5Ef0F2nngVOW4gsGPgdj303W/sTbkuz5fJXhCUFmdjXhXex7t zuKEMCRxGcOGXNbWbUgQr/dbV27yb80A8W59V11w= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Tamir Duberstein , Alice Ryhl , Petr Mladek , Miguel Ojeda , Sasha Levin Subject: [PATCH 6.14 405/731] rust: fix signature of rust_fmt_argument Date: Tue, 8 Apr 2025 12:45:02 +0200 Message-ID: <20250408104923.694104696@linuxfoundation.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250408104914.247897328@linuxfoundation.org> References: <20250408104914.247897328@linuxfoundation.org> User-Agent: quilt/0.68 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Alice Ryhl [ Upstream commit 901b3290bd4dc35e613d13abd03c129e754dd3dd ] Without this change, the rest of this series will emit the following error message: error[E0308]: `if` and `else` have incompatible types --> /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. To fix this, change the void pointer argument to use a const pointer, and change the imports to use crate::ffi instead of core::ffi for integer types. Fixes: 787983da7718 ("vsprintf: add new `%pA` format specifier") Reviewed-by: Tamir Duberstein Acked-by: Greg Kroah-Hartman Signed-off-by: Alice Ryhl Acked-by: Petr Mladek Link: https://lore.kernel.org/r/20250303-export-macro-v3-1-41fbad85a27f@google.com Signed-off-by: Miguel Ojeda Signed-off-by: Sasha Levin --- lib/vsprintf.c | 2 +- rust/kernel/print.rs | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/lib/vsprintf.c b/lib/vsprintf.c index 56fe963192926..a8ac4c4fffcf2 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 b19ee490be58f..61ee36c5e5f5d 100644 --- a/rust/kernel/print.rs +++ b/rust/kernel/print.rs @@ -6,12 +6,11 @@ //! //! Reference: -use core::{ +use crate::{ ffi::{c_char, c_void}, - fmt, + str::RawFormatter, }; - -use crate::str::RawFormatter; +use core::fmt; // Called from `vsprintf` with format specifier `%pA`. #[expect(clippy::missing_safety_doc)] -- 2.39.5