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: <D312AF37-03C4-4469-8BA1-669B62B74EFC@collabora.com>
Date: Wed, 16 Jul 2025 16:18:26 -0300
From: Daniel Almeida <daniel.almeida@...labora.com>
To: Danilo Krummrich <dakr@...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 <lossin@...nel.org>,
 Andreas Hindborg <a.hindborg@...nel.org>,
 Alice Ryhl <aliceryhl@...gle.com>,
 Trevor Gross <tmgross@...ch.edu>,
 linux-kernel@...r.kernel.org,
 rust-for-linux@...r.kernel.org,
 Alexandre Courbot <acourbot@...dia.com>
Subject: Re: [PATCH v9] rust: kernel: add support for bits/genmask macros


> 
>> 
>> (3) OOC, why did you choose u32 as argument type?
> 
> No reason. i32 is the default integer type and signed integers don’t make
> sense here, so I chose u32.
> 
> Also, we can trivially promote integers to wider types,  but the other way
> around is not true. So my reasoning was that if you had u8, or u16s you could
> trivially get u32s using into(), but if you had u32s and e.g. genmask_u16
> required u16s, you'd have to resort to try_into() or `as`, which is annoying.
> 
> In any case, feel free to suggest anything else, I think.
> 
> — Daniel

I guess that, using the logic above, one could ask "why not u64 then?".

64bit variables are less commonly used, so this would be the inverse
problem, i.e.: we'd see way too many uses of into().

— Daniel

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ