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: <CAJ-ks9m-SXiftYGY_Rz-tgLQMvJ5OGfCtn9b0E+Okjm4waCooQ@mail.gmail.com>
Date: Sat, 1 Feb 2025 17:01:25 -0500
From: Tamir Duberstein <tamird@...il.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 <benno.lossin@...ton.me>, Andreas Hindborg <a.hindborg@...nel.org>, 
	Alice Ryhl <aliceryhl@...gle.com>, Trevor Gross <tmgross@...ch.edu>, rust-for-linux@...r.kernel.org, 
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] rust: alloc: satisfy `aligned_alloc` requirements

On Sat, Feb 1, 2025 at 4:58 PM Danilo Krummrich <dakr@...nel.org> wrote:
>
> On Sat, Feb 01, 2025 at 04:19:48PM -0500, Tamir Duberstein wrote:
> > Hi Danilo, thanks for the review!
> >
> > On Sat, Feb 1, 2025 at 3:18 PM Danilo Krummrich <dakr@...nel.org> wrote:
> > >
> > > I think I prefer this to be slightly more compact:
> > >
> > >    let min_align = core::mem::size_of::<*const crate::ffi::c_void>();
> > >    let (align, size) = if layout.align() < min_align {
> > >        (min_align, layout.size().div_ceil(min_align) * min_align)
> > >    } else {
> > >        (layout.align(), layout.size())
> > >    };
> >
> > I was trying to avoid repeated calls to either function, but I'm happy
> > to shorten the variable names. Would that suit?
>
> I think calling layout.align() twice is fine, no need shadow align for that.

Sure. Anything else?

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ