[PATCH] rust_binder: replace `kernel::c_str!` with C-Strings

Tamir Duberstein posted 1 patch 1 month, 2 weeks ago
drivers/android/binder/rust_binder_main.rs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] rust_binder: replace `kernel::c_str!` with C-Strings
Posted by Tamir Duberstein 1 month, 2 weeks ago
From: Tamir Duberstein <tamird@gmail.com>

C-String literals were added in Rust 1.77. Replace instances of
`kernel::c_str!` with C-String literals where possible.

Signed-off-by: Tamir Duberstein <tamird@gmail.com>
---
 drivers/android/binder/rust_binder_main.rs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/android/binder/rust_binder_main.rs b/drivers/android/binder/rust_binder_main.rs
index c79a9e742240..519bc2fb310d 100644
--- a/drivers/android/binder/rust_binder_main.rs
+++ b/drivers/android/binder/rust_binder_main.rs
@@ -288,7 +288,7 @@ fn init(_module: &'static kernel::ThisModule) -> Result<Self> {
 
         pr_warn!("Loaded Rust Binder.");
 
-        BINDER_SHRINKER.register(kernel::c_str!("android-binder"))?;
+        BINDER_SHRINKER.register(c"android-binder")?;
 
         // SAFETY: The module is being loaded, so we can initialize binderfs.
         unsafe { kernel::error::to_result(binderfs::init_rust_binderfs())? };

---
base-commit: 8f0b4cce4481fb22653697cced8d0d04027cb1e8
change-id: 20251222-cstr-staging-e96cbee7d73e

Best regards,
--  
Tamir Duberstein <tamird@gmail.com>
Re: [PATCH] rust_binder: replace `kernel::c_str!` with C-Strings
Posted by Daniel Almeida 1 month, 2 weeks ago

> On 22 Dec 2025, at 09:22, Tamir Duberstein <tamird@kernel.org> wrote:
> 
> From: Tamir Duberstein <tamird@gmail.com>
> 
> C-String literals were added in Rust 1.77. Replace instances of
> `kernel::c_str!` with C-String literals where possible.
> 
> Signed-off-by: Tamir Duberstein <tamird@gmail.com>
> ---
> drivers/android/binder/rust_binder_main.rs | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/android/binder/rust_binder_main.rs b/drivers/android/binder/rust_binder_main.rs
> index c79a9e742240..519bc2fb310d 100644
> --- a/drivers/android/binder/rust_binder_main.rs
> +++ b/drivers/android/binder/rust_binder_main.rs
> @@ -288,7 +288,7 @@ fn init(_module: &'static kernel::ThisModule) -> Result<Self> {
> 
>         pr_warn!("Loaded Rust Binder.");
> 
> -        BINDER_SHRINKER.register(kernel::c_str!("android-binder"))?;
> +        BINDER_SHRINKER.register(c"android-binder")?;
> 
>         // SAFETY: The module is being loaded, so we can initialize binderfs.
>         unsafe { kernel::error::to_result(binderfs::init_rust_binderfs())? };
> 
> ---
> base-commit: 8f0b4cce4481fb22653697cced8d0d04027cb1e8
> change-id: 20251222-cstr-staging-e96cbee7d73e
> 
> Best regards,
> --  
> Tamir Duberstein <tamird@gmail.com>
> 
> 

Reviewed-by: Daniel Almeida <daniel.almeida@collabora.com>
Re: [PATCH] rust_binder: replace `kernel::c_str!` with C-Strings
Posted by Alice Ryhl 1 month, 1 week ago
On Mon, Dec 22, 2025 at 01:22:17PM +0100, Tamir Duberstein wrote:
> From: Tamir Duberstein <tamird@gmail.com>
> 
> C-String literals were added in Rust 1.77. Replace instances of
> `kernel::c_str!` with C-String literals where possible.
> 
> Signed-off-by: Tamir Duberstein <tamird@gmail.com>

Reviewed-by: Alice Ryhl <aliceryhl@google.com>