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: <DBLN5HS5I4UT.2KP9UI3AUFJ99@nvidia.com>
Date: Sat, 26 Jul 2025 11:46:07 +0900
From: "Alexandre Courbot" <acourbot@...dia.com>
To: "Danilo Krummrich" <dakr@...nel.org>
Cc: "Abdiel Janulgue" <abdiel.janulgue@...il.com>, "Daniel Almeida"
 <daniel.almeida@...labora.com>, "Robin Murphy" <robin.murphy@....com>,
 "Andreas Hindborg" <a.hindborg@...nel.org>, "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"
 <lossin@...nel.org>, "Alice Ryhl" <aliceryhl@...gle.com>, "Trevor Gross"
 <tmgross@...ch.edu>, "Christian S. Lima" <christiansantoslima21@...il.com>,
 <rust-for-linux@...r.kernel.org>, <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v2] rust: transmute: add `as_bytes` method for `AsBytes`
 trait

On Sat Jul 26, 2025 at 12:07 AM JST, Danilo Krummrich wrote:
> On 7/25/25 3:08 PM, Alexandre Courbot wrote:
>> diff --git a/rust/kernel/transmute.rs b/rust/kernel/transmute.rs
>> index 1c7d43771a37b90150de86699f114a2ffb84db91..d4036986a3d7fb97e5da3e121e9590ad23b784e9 100644
>> --- a/rust/kernel/transmute.rs
>> +++ b/rust/kernel/transmute.rs
>> @@ -47,7 +47,16 @@ macro_rules! impl_frombytes {
>>   ///
>>   /// Values of this type may not contain any uninitialized bytes. This type must not have interior
>>   /// mutability.
>> -pub unsafe trait AsBytes {}
>> +pub unsafe trait AsBytes {
>> +    /// Returns `self` as a slice of bytes.
>> +    fn as_bytes(&self) -> &[u8] {
>> +        let data = (self as *const Self).cast::<u8>();
>
> I'd probably use from_ref() instead. With that,

Oh yes I always forget about this one...

>
> 	Reviewed-by: Danilo Krummrich <dakr@...nel.org>

Thanks!

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ