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 C4DD71AAA32; Tue, 8 Apr 2025 12:36:21 +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=1744115781; cv=none; b=ko6/gwZ5i39zDyKBlMdStwcCf5WFf0Y0RcSrShBTZ3FDELrh5ioWOTugqho9szPsV634gFLeO6erX+OMTXk12BWGTnUbgbH+4NfPPJe+gsn05Z77IihK9LKVJarPyq/jCOmzO80voJG+42yX5vd3IPweIymhd3HkpBJ0XhNdxDQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744115781; c=relaxed/simple; bh=zfsiBOAxlueymf7Ru1iaR3HJYRRwWvuFPVt0sevIkao=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=HMhayd82EYPdBHVpDJezu/jECOYCuYZMcO2TI1bsnrjBrn3BFMlJ/99RArnN8xOdgq9SyD90YlQknkEhRS2jUlzOPUnuUvZp9JRe7ybPwW/Pbdv8h3qzrmsHxPtrcactGVSrXtSDGvridMHwt9QBQr6wqHHNOzrhwo9B759fKEs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=L9Q7r0sb; 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="L9Q7r0sb" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4FA65C4CEE5; Tue, 8 Apr 2025 12:36:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1744115781; bh=zfsiBOAxlueymf7Ru1iaR3HJYRRwWvuFPVt0sevIkao=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=L9Q7r0sbp3R1oUtzOO9h40Jsnu0X2rvqcQssXMKL0JVYOKkBoUNpr84ylHu6q5064 YWDSeZPTRCskAeIPWFVNCyRQ5D+jUW1h14QjdlpVkSGPB4yfYWN98nmGYXd3GqZ0wg MZft7Cva41GM9li8NV+qxBn+912V22GhKLT7t3Kk= 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.1 075/204] rust: fix signature of rust_fmt_argument Date: Tue, 8 Apr 2025 12:50:05 +0200 Message-ID: <20250408104822.561847019@linuxfoundation.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250408104820.266892317@linuxfoundation.org> References: <20250408104820.266892317@linuxfoundation.org> User-Agent: quilt/0.68 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.1-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 fa1c197018551..408a92c5a4f79 100644 --- a/lib/vsprintf.c +++ b/lib/vsprintf.c @@ -2257,7 +2257,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 b6d1c12136de1..e21be6996932e 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; #[cfg(CONFIG_PRINTK)] use crate::bindings; -- 2.39.5