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: <20230413133322.12d58380.gary@garyguo.net>
Date:   Thu, 13 Apr 2023 13:33:22 +0100
From:   Gary Guo <gary@...yguo.net>
To:     Benno Lossin <benno.lossin@...ton.me>
Cc:     Miguel Ojeda <ojeda@...nel.org>,
        Alex Gaynor <alex.gaynor@...il.com>,
        Wedson Almeida Filho <wedsonaf@...il.com>,
        Boqun Feng <boqun.feng@...il.com>,
        Björn Roy Baron <bjorn3_gh@...tonmail.com>,
        rust-for-linux@...r.kernel.org, linux-kernel@...r.kernel.org,
        patches@...ts.linux.dev
Subject: Re: [PATCH] rust: init: broaden the blanket impl of `Init`

On Thu, 13 Apr 2023 10:02:17 +0000
Benno Lossin <benno.lossin@...ton.me> wrote:

> This makes it possible to use `T` as a `impl Init<T, E>` for every error
> type `E` instead of just `Infallible`.
> 
> Signed-off-by: Benno Lossin <benno.lossin@...ton.me>

Reviewed-by: Gary Guo <gary@...yguo.net>

> ---
> 
> @Miguel: you can squash this patch into 90e53c5e70a69 or put it on top of
> rust-next.
> 
>  rust/kernel/init.rs | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/rust/kernel/init.rs b/rust/kernel/init.rs
> index a1298c8bbda0..4ebfb08dab11 100644
> --- a/rust/kernel/init.rs
> +++ b/rust/kernel/init.rs
> @@ -1190,8 +1190,8 @@ pub fn uninit<T, E>() -> impl Init<MaybeUninit<T>, E> {
>  }
> 
>  // SAFETY: Every type can be initialized by-value.
> -unsafe impl<T> Init<T> for T {
> -    unsafe fn __init(self, slot: *mut T) -> Result<(), Infallible> {
> +unsafe impl<T, E> Init<T, E> for T {
> +    unsafe fn __init(self, slot: *mut T) -> Result<(), E> {
>          unsafe { slot.write(self) };
>          Ok(())
>      }
> 
> base-commit: 1944caa8e8dcb2d93d99d8364719ad8d07aa163f
> --
> 2.39.2
> 
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ