Skip to contentSkip to conversation

rust_binder: replace `kernel::c_str!` with C-Strings

PATCH In review Tamir Duberstein 3 participants 3 messages Dec 22, 2025 – Dec 26, 2025

Subsystems (2)
lore
Share & tools
lore

Tamir Duberstein

author reviewer
#0 lore raw

PATCH 1/1 rust_binder: replace `kernel::c_str!` with C-Strings

From: Tamir Duberstein <[email protected]>

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

---
 drivers/android/binder/rust_binder_main.rs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/android/binder/rust_binder_main.rs +1 -1
index c79a9e742240..519bc2fb310d 100644
@@ -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,

Signature · 1 line
Tamir Duberstein <[email protected]>
reviewer Reviewed-by on v1 1/1
#1 lore raw
Quoted 32 lines · Tamir Duberstein

From: Tamir Duberstein <[email protected]>

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

---
drivers/android/binder/rust_binder_main.rs | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)
drivers/android/binder/rust_binder_main.rs +1 -2
index c79a9e742240..519bc2fb310d 100644
@@ -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

Quoted 5 lines

Best regards,

Signature · 1 line
Tamir Duberstein <[email protected]>