[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CANiq72=axLe_WvPohRRpAnmmPOHtwSK1W3e86n7FMF2mao8HUg@mail.gmail.com>
Date: Sat, 23 Nov 2024 18:39:23 +0100
From: Miguel Ojeda <miguel.ojeda.sandonis@...il.com>
To: Asahi Lina <lina@...hilina.net>
Cc: Danilo Krummrich <dakr@...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 <benno.lossin@...ton.me>, Andreas Hindborg <a.hindborg@...nel.org>,
Alice Ryhl <aliceryhl@...gle.com>, Trevor Gross <tmgross@...ch.edu>, Janne Grunau <j@...nau.net>,
rust-for-linux@...r.kernel.org, linux-kernel@...r.kernel.org,
asahi@...ts.linux.dev
Subject: Re: [PATCH] rust: alloc: Fix `ArrayLayout` allocations
On Sat, Nov 23, 2024 at 11:30 AM Asahi Lina <lina@...hilina.net> wrote:
>
> We were accidentally allocating a layout for the *square* of the object
> size due to a variable shadowing mishap.
Good catch, thanks! (Square?)
`clippy::shadow_reuse` would catch this, but it does catch a lot more
things, sadly.
I sent:
https://github.com/rust-lang/rust-clippy/issues/3433#issuecomment-2495547322
and added it to the Clippy list. If one of the ideas in the issue are
implemented, then I think we should easily enable it.
Similarly, we could do `shadow_unrelated` -- that one seems easier,
and perhaps we should do it anyway, at least a couple cases I saw
would make the code clearer.
Cheers,
Miguel
Powered by blists - more mailing lists