summaryrefslogtreecommitdiff
path: root/drivers/android/binder/stats.rs
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/android/binder/stats.rs')
-rw-r--r--drivers/android/binder/stats.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/android/binder/stats.rs b/drivers/android/binder/stats.rs
index a83ec111d2cb..037002651941 100644
--- a/drivers/android/binder/stats.rs
+++ b/drivers/android/binder/stats.rs
@@ -61,7 +61,7 @@ impl BinderStats {
mod strings {
use core::str::from_utf8_unchecked;
- use kernel::str::CStr;
+ use kernel::str::{CStr, CStrExt as _};
extern "C" {
static binder_command_strings: [*const u8; super::BC_COUNT];
@@ -72,7 +72,7 @@ mod strings {
// SAFETY: Accessing `binder_command_strings` is always safe.
let c_str_ptr = unsafe { binder_command_strings[i] };
// SAFETY: The `binder_command_strings` array only contains nul-terminated strings.
- let bytes = unsafe { CStr::from_char_ptr(c_str_ptr) }.as_bytes();
+ let bytes = unsafe { CStr::from_char_ptr(c_str_ptr) }.to_bytes();
// SAFETY: The `binder_command_strings` array only contains strings with ascii-chars.
unsafe { from_utf8_unchecked(bytes) }
}
@@ -81,7 +81,7 @@ mod strings {
// SAFETY: Accessing `binder_return_strings` is always safe.
let c_str_ptr = unsafe { binder_return_strings[i] };
// SAFETY: The `binder_command_strings` array only contains nul-terminated strings.
- let bytes = unsafe { CStr::from_char_ptr(c_str_ptr) }.as_bytes();
+ let bytes = unsafe { CStr::from_char_ptr(c_str_ptr) }.to_bytes();
// SAFETY: The `binder_command_strings` array only contains strings with ascii-chars.
unsafe { from_utf8_unchecked(bytes) }
}