Skip to content

Commit 0dac8cf

Browse files
tamirdojeda
authored andcommitted
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 eafedbc ("rust_binder: add Rust Binder driver"). Reviewed-by: Alice Ryhl <[email protected]> Signed-off-by: Tamir Duberstein <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Miguel Ojeda <[email protected]>
1 parent 5aed967 commit 0dac8cf

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/android/binder/stats.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ mod strings {
7272
// SAFETY: Accessing `binder_command_strings` is always safe.
7373
let c_str_ptr = unsafe { binder_command_strings[i] };
7474
// 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();
7676
// SAFETY: The `binder_command_strings` array only contains strings with ascii-chars.
7777
unsafe { from_utf8_unchecked(bytes) }
7878
}
@@ -81,7 +81,7 @@ mod strings {
8181
// SAFETY: Accessing `binder_return_strings` is always safe.
8282
let c_str_ptr = unsafe { binder_return_strings[i] };
8383
// 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();
8585
// SAFETY: The `binder_command_strings` array only contains strings with ascii-chars.
8686
unsafe { from_utf8_unchecked(bytes) }
8787
}

0 commit comments

Comments
 (0)