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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240220093541.280140-1-aliceryhl@google.com>
Date: Tue, 20 Feb 2024 09:35:40 +0000
From: Alice Ryhl <aliceryhl@...gle.com>
To: dakr@...hat.com
Cc: a.hindborg@...sung.com, alex.gaynor@...il.com, aliceryhl@...gle.com, 
	benno.lossin@...ton.me, bjorn3_gh@...tonmail.com, boqun.feng@...il.com, 
	gary@...yguo.net, linux-kernel@...r.kernel.org, ojeda@...nel.org, 
	rust-for-linux@...r.kernel.org, wedsonaf@...il.com
Subject: Re: [PATCH v4] rust: str: add {make,to}_{upper,lower}case() to CString

> Add functions to convert a CString to upper- / lowercase, either
> in-place or by creating a copy of the original CString.
> 
> Naming followes the one from the Rust stdlib, where functions starting
> with 'to' create a copy and functions starting with 'make' perform an
> in-place conversion.
> 
> This is required by the Nova project (GSP only Rust successor of
> Nouveau) to convert stringified enum values (representing different GPU
> chipsets) to strings in order to generate the corresponding firmware
> paths. See also [1].
> 
> [1] https://rust-for-linux.zulipchat.com/#narrow/stream/288089-General/topic/String.20manipulation.20in.20kernel.20Rust
> 
> Signed-off-by: Danilo Krummrich <dakr@...hat.com>

This looks good to me, so you may add my

Reviewed-by: Alice Ryhl <aliceryhl@...gle.com>

However, it looks like this patch has some clippy warnings that need to
be fixed before it can be merged.

$ make LLVM=1 CLIPPY=1
error: unneeded `return` statement
   --> rust/kernel/str.rs:267:9
    |
267 |         return Ok(s);
    |         ^^^^^^^^^^^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
    = note: `-D clippy::needless-return` implied by `-D clippy::style`
    = help: to override `-D clippy::style` add `#[allow(clippy::needless_return)]`
help: remove `return`
    |
267 -         return Ok(s);
267 +         Ok(s)
    |

error: unneeded `return` statement
   --> rust/kernel/str.rs:284:9
    |
284 |         return Ok(s);
    |         ^^^^^^^^^^^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
help: remove `return`
    |
284 -         return Ok(s);
284 +         Ok(s)
    |

error: deref which would be done by auto-deref
   --> rust/kernel/str.rs:677:58
    |
677 |         unsafe { CStr::from_bytes_with_nul_unchecked_mut(&mut *self.buf) }
    |                                                          ^^^^^^^^^^^^^^ help: try: `&mut self.buf`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#explicit_auto_deref
    = note: `-D clippy::explicit-auto-deref` implied by `-D clippy::complexity`
    = help: to override `-D clippy::complexity` add `#[allow(clippy::explicit_auto_deref)]`

error: aborting due to 3 previous errors

Alice

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ