Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

rust_binder: use `core::ffi::CStr` method names

Prepare for `core::ffi::CStr` taking the place of `kernel::str::CStr` by
avoiding methods that only exist on the latter.

This backslid in commit eafedbc7c050 ("rust_binder: add Rust Binder
driver").

Reviewed-by: Alice Ryhl <aliceryhl@google.com>
Signed-off-by: Tamir Duberstein <tamird@gmail.com>
Link: https://patch.msgid.link/20251018-cstr-core-v18-4-9378a54385f8@gmail.com
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>

authored by

Tamir Duberstein and committed by
Miguel Ojeda
0dac8cf4 5aed9677

+2 -2
+2 -2
drivers/android/binder/stats.rs
··· 72 72 // SAFETY: Accessing `binder_command_strings` is always safe. 73 73 let c_str_ptr = unsafe { binder_command_strings[i] }; 74 74 // SAFETY: The `binder_command_strings` array only contains nul-terminated strings. 75 - let bytes = unsafe { CStr::from_char_ptr(c_str_ptr) }.as_bytes(); 75 + let bytes = unsafe { CStr::from_char_ptr(c_str_ptr) }.to_bytes(); 76 76 // SAFETY: The `binder_command_strings` array only contains strings with ascii-chars. 77 77 unsafe { from_utf8_unchecked(bytes) } 78 78 } ··· 81 81 // SAFETY: Accessing `binder_return_strings` is always safe. 82 82 let c_str_ptr = unsafe { binder_return_strings[i] }; 83 83 // SAFETY: The `binder_command_strings` array only contains nul-terminated strings. 84 - let bytes = unsafe { CStr::from_char_ptr(c_str_ptr) }.as_bytes(); 84 + let bytes = unsafe { CStr::from_char_ptr(c_str_ptr) }.to_bytes(); 85 85 // SAFETY: The `binder_command_strings` array only contains strings with ascii-chars. 86 86 unsafe { from_utf8_unchecked(bytes) } 87 87 }