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] [day] [month] [year] [list]
Message-ID: <87ldumj77b.fsf@kernel.org>
Date: Tue, 04 Feb 2025 12:11:04 +0100
From: Andreas Hindborg <a.hindborg@...nel.org>
To: "Jens Korinth via B4 Relay" <devnull+jens.korinth.tuta.io@...nel.org>
Cc: "Miguel Ojeda" <ojeda@...nel.org>,  "Alex Gaynor"
 <alex.gaynor@...il.com>,  "Boqun Feng" <boqun.feng@...il.com>,  "Gary Guo"
 <gary@...yguo.net>,  Björn Roy Baron
 <bjorn3_gh@...tonmail.com>,  "Benno
 Lossin" <benno.lossin@...ton.me>,  "Alice Ryhl" <aliceryhl@...gle.com>,
  "Trevor Gross" <tmgross@...ch.edu>,  <jens.korinth@...a.io>,
  <rust-for-linux@...r.kernel.org>,  "FUJITA Tomonori"
 <fujita.tomonori@...il.com>,  "Dirk Behme" <dirk.behme@...il.com>,
  <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v4 1/3] rust: Add `OnceLite` for executing code once

"Jens Korinth via B4 Relay" <devnull+jens.korinth.tuta.io@...nel.org> writes:

> From: Jens Korinth <jens.korinth@...a.io>
>
> Similar to `Once` in Rust's standard library, but with the same
> non-blocking behavior as the kernel's `DO_ONCE_LITE` macro. Abstraction
> allows easy replacement of the underlying sync mechanisms, see
>
> https://lore.kernel.org/rust-for-linux/20241109-pr_once_macros-v3-0-6beb24e0cac8@tuta.io/.
>
> Suggested-by: Boqun Feng <boqun.feng@...il.com>
> Signed-off-by: Jens Korinth <jens.korinth@...a.io>

Thanks for the patch!

I was using the series for `pr_warn_once!` elsewhere, and clippy gave me
this suggestion:

  CLIPPY L rust/kernel.o
error: you should consider adding a `Default` implementation for `OnceLite`
  --> /home/aeh/src/linux-rust/module-params/rust/kernel/once_lite.rs:52:5
   |
52 | /     pub const fn new() -> Self {
53 | |         Self(AtomicBool::new(false), AtomicBool::new(false))
54 | |     }
   | |_____^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#new_without_default
   = note: `-D clippy::new-without-default` implied by `-D warnings`
   = help: to override `-D warnings` add `#[allow(clippy::new_without_default)]`
help: try adding this
   |
49 + impl Default for OnceLite {
50 +     fn default() -> Self {
51 +         Self::new()
52 +     }
53 + }
   |



Best regards,
Andreas Hindborg




Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ