lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <aSQmmxRzFR0Bqj1v@google.com>
Date: Mon, 24 Nov 2025 09:34:19 +0000
From: Alice Ryhl <aliceryhl@...gle.com>
To: Navaneeth K <knavaneeth786@...il.com>
Cc: ojeda@...nel.org, alex.gaynor@...il.com, wedsonaf@...il.com, 
	rust-for-linux@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/2] rust: kernel: document safety for as_str_unchecked

On Sat, Nov 22, 2025 at 07:09:08PM +0000, Navaneeth K wrote:
> Replace the TODO safety comment with a proper explanation.
> The safety of from_utf8_unchecked relies on the caller guaranteeing
> that the input bytes are valid UTF-8.
> 
> Signed-off-by: Navaneeth K <knavaneeth786@...il.com>
> ---
>  rust/kernel/str.rs | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/rust/kernel/str.rs b/rust/kernel/str.rs
> index 5c74e5f77601..2801388c6bd1 100644
> --- a/rust/kernel/str.rs
> +++ b/rust/kernel/str.rs
> @@ -385,7 +385,7 @@ pub fn to_str(&self) -> Result<&str, core::str::Utf8Error> {
>      /// ```
>      #[inline]
>      pub unsafe fn as_str_unchecked(&self) -> &str {
> -        // SAFETY: TODO.
> +        // SAFETY: The caller guarantees that the contents are valid UTF-8.
>          unsafe { core::str::from_utf8_unchecked(self.as_bytes()) }

As far as I know another patch is deleting this method, so I don't think
there is anything to fix anymore.

Alice

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ