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 F138A206F18; Tue, 8 Apr 2025 12:18:44 +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=1744114725; cv=none; b=CgzKA5fvPaAo377dWD2bbl4abAi5jHln7N8EaCRlJFxbSjHqZgzFuAY0uIRZ/DUs2hUOB/bNH5H1bbazQswTQH9W5bc1z807QDuRLenh7KKJk39L6cYWQ/SR+B3fkhrfCn0FnMhnZ7ARuI6rhIQuWWPj+/wCeREIirA86d7gGQc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744114725; c=relaxed/simple; bh=d+0drtCsFZ2t5vdYEb23k5nWa4J4SK7SBKqiMk8lfy4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=uN4U7fV2kcjJLy6j3VnxbdJq8xmcr4f4WsFHImjgkStXkJubzQe9eWs6lJfY38LlLkC74J8ktHXIg997NvbdHC1nfPi8HGBXUQ/Utl3+J+4HfBDN59u6yPxozVY+m+VZRt5KdwRdh0+apkHDjeo/ksYFSj5SGY7l+jTo1PEOXxo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=mHr3DfTL; 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="mHr3DfTL" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7DAF4C4CEE5; Tue, 8 Apr 2025 12:18:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1744114724; bh=d+0drtCsFZ2t5vdYEb23k5nWa4J4SK7SBKqiMk8lfy4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mHr3DfTLazywxaZTwbwYE2yca/UjKX2/qy5/nrXGvxTzkxmFvFhlkqKtQGBPv2589 WSYuVm00a2sEUlL7QcY+n0oxKukz8zFXKUn15owmqRuYft7Ov2gw0TiLuESjOTiQUQ JCGs/7SgAL5uU/1BsXQLE46SSZVcC/ZeIfsnAzsE= 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.13 173/499] rust: fix signature of rust_fmt_argument Date: Tue, 8 Apr 2025 12:46:25 +0200 Message-ID: <20250408104855.490856438@linuxfoundation.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250408104851.256868745@linuxfoundation.org> References: <20250408104851.256868745@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.13-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 9d3dac38a3f4a..2b86b2c72897f 100644 --- a/lib/vsprintf.c +++ b/lib/vsprintf.c @@ -2299,7 +2299,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