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] [thread-next>] [day] [month] [year] [list]
Message-ID: <b379184a-c1ca-47b5-856f-62144edf3baf@proton.me>
Date: Tue, 02 Jul 2024 06:28:03 +0000
From: Benno Lossin <benno.lossin@...ton.me>
To: Miguel Ojeda <miguel.ojeda.sandonis@...il.com>, Björn Roy Baron <bjorn3_gh@...tonmail.com>
Cc: Miguel Ojeda <ojeda@...nel.org>, Wedson Almeida Filho <wedsonaf@...il.com>, Alex Gaynor <alex.gaynor@...il.com>, Boqun Feng <boqun.feng@...il.com>, Gary Guo <gary@...yguo.net>, Andreas Hindborg <a.hindborg@...sung.com>, Alice Ryhl <aliceryhl@...gle.com>, rust-for-linux@...r.kernel.org, linux-kernel@...r.kernel.org, patches@...ts.linux.dev
Subject: Re: [PATCH 02/13] rust: init: simplify from `map_err` to `inspect_err`

On 01.07.24 23:58, Miguel Ojeda wrote:
> On Mon, Jul 1, 2024 at 10:05 PM Björn Roy Baron
> <bjorn3_gh@...tonmail.com> wrote:
>>
>> The formatting here is a bit weird. I would have expected the ) ending the inspect_err call to be placed on a new line given that the unsafe block isn't placed on the same line as the start of the inspect_err call either. This seems to be a case where rustfmt mostly gives up on formatting. If I deindent the comment and unsafe block rustfmt will keep it that way and if I add a trailing space to the inspect_err line it will keep it and emit an error that it left behind trailing whitespace. Maybe add a block around the comment and unsafe block to make rustfmt work again?
> 
> Benno: any preference here? Or even open coding it.

I would put the comment outside of the closure:

    let val = unsafe { &mut *slot };
    // SAFETY: `slot` is considered pinned.
    let val = unsafe { Pin::new_unchecked(val) };
    // SAFETY: `slot` was initialized above.
    (self.1)(val).inspect_err(|_| unsafe { core::ptr::drop_in_place(slot) })

---
Cheers,
Benno


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ