lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAJ-ks9nDDceVKjLengGsjJvxTT9Mc5SqRfyteuOw4AsO1KWhLQ@mail.gmail.com>
Date: Sat, 3 Jan 2026 21:28:01 -0500
From: Tamir Duberstein <tamird@...il.com>
To: Andreas Hindborg <a.hindborg@...nel.org>, Breno Leitao <leitao@...ian.org>, 
	Miguel Ojeda <ojeda@...nel.org>, Boqun Feng <boqun.feng@...il.com>, Gary Guo <gary@...yguo.net>, 
	Björn Roy Baron <bjorn3_gh@...tonmail.com>, 
	Benno Lossin <lossin@...nel.org>, Alice Ryhl <aliceryhl@...gle.com>, 
	Trevor Gross <tmgross@...ch.edu>, Danilo Krummrich <dakr@...nel.org>
Cc: rust-for-linux@...r.kernel.org, linux-kernel@...r.kernel.org, 
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Subject: Re: [PATCH] rust: configfs: replace `kernel::c_str!` with C-Strings

On Mon, Dec 22, 2025 at 7:12 AM Tamir Duberstein <tamird@...nel.org> wrote:
>
> From: Tamir Duberstein <tamird@...il.com>
>
> C-String literals were added in Rust 1.77. Replace instances of
> `kernel::c_str!` with C-String literals where possible.
>
> Acked-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
> Reviewed-by: Alice Ryhl <aliceryhl@...gle.com>
> Reviewed-by: Benno Lossin <lossin@...nel.org>
> Signed-off-by: Tamir Duberstein <tamird@...il.com>
> Acked-by: Andreas Hindborg <a.hindborg@...nel.org>
> ---
>  rust/kernel/configfs.rs       | 9 +++++----
>  samples/rust/rust_configfs.rs | 5 ++---
>  2 files changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/rust/kernel/configfs.rs b/rust/kernel/configfs.rs
> index 466fb7f40762..2339c6467325 100644
> --- a/rust/kernel/configfs.rs
> +++ b/rust/kernel/configfs.rs
> @@ -21,7 +21,6 @@
>  //!
>  //! ```ignore
>  //! use kernel::alloc::flags;
> -//! use kernel::c_str;
>  //! use kernel::configfs_attrs;
>  //! use kernel::configfs;
>  //! use kernel::new_mutex;
> @@ -50,7 +49,7 @@
>  //!
>  //!         try_pin_init!(Self {
>  //!             config <- configfs::Subsystem::new(
> -//!                 c_str!("rust_configfs"), item_type, Configuration::new()
> +//!                 c"rust_configfs", item_type, Configuration::new()
>  //!             ),
>  //!         })
>  //!     }
> @@ -66,7 +65,7 @@
>  //! impl Configuration {
>  //!     fn new() -> impl PinInit<Self, Error> {
>  //!         try_pin_init!(Self {
> -//!             message: c_str!("Hello World\n"),
> +//!             message: c"Hello World\n",
>  //!             bar <- new_mutex!((KBox::new([0; PAGE_SIZE], flags::GFP_KERNEL)?, 0)),
>  //!         })
>  //!     }
> @@ -1000,7 +999,9 @@ macro_rules! configfs_attrs {
>                      static [< $data:upper _ $name:upper _ATTR >]:
>                          $crate::configfs::Attribute<$attr, $data, $data> =
>                              unsafe {
> -                                $crate::configfs::Attribute::new(c_str!(::core::stringify!($name)))
> +                                $crate::configfs::Attribute::new(
> +                                    $crate::c_str!(::core::stringify!($name)),
> +                                )
>                              };
>                  )*
>
> diff --git a/samples/rust/rust_configfs.rs b/samples/rust/rust_configfs.rs
> index 0ccc7553ef39..a1bd9db6010d 100644
> --- a/samples/rust/rust_configfs.rs
> +++ b/samples/rust/rust_configfs.rs
> @@ -3,7 +3,6 @@
>  //! Rust configfs sample.
>
>  use kernel::alloc::flags;
> -use kernel::c_str;
>  use kernel::configfs;
>  use kernel::configfs::configfs_attrs;
>  use kernel::new_mutex;
> @@ -35,7 +34,7 @@ struct Configuration {
>  impl Configuration {
>      fn new() -> impl PinInit<Self, Error> {
>          try_pin_init!(Self {
> -            message: c_str!("Hello World\n"),
> +            message: c"Hello World\n",
>              bar <- new_mutex!((KBox::new([0; PAGE_SIZE], flags::GFP_KERNEL)?, 0)),
>          })
>      }
> @@ -61,7 +60,7 @@ fn init(_module: &'static ThisModule) -> impl PinInit<Self, Error> {
>
>          try_pin_init!(Self {
>              config <- configfs::Subsystem::new(
> -                c_str!("rust_configfs"), item_type, Configuration::new()
> +                c"rust_configfs", item_type, Configuration::new()
>              ),
>          })
>      }
>
> ---
> base-commit: 8f0b4cce4481fb22653697cced8d0d04027cb1e8
> change-id: 20251222-cstr-configfs-3e5e5092f187
>
> Best regards,
> --
> Tamir Duberstein <tamird@...il.com>
>

@Andreas could you please have a look?

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ