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: <D8EE4BXJ5NLB.8BBCUV0UXWY5@proton.me>
Date: Wed, 12 Mar 2025 15:25:00 +0000
From: Benno Lossin <benno.lossin@...ton.me>
To: Tamir Duberstein <tamird@...il.com>
Cc: Masahiro Yamada <masahiroy@...nel.org>, Nathan Chancellor <nathan@...nel.org>, Nicolas Schier <nicolas@...sle.eu>, 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>, Andreas Hindborg <a.hindborg@...nel.org>, Alice Ryhl <aliceryhl@...gle.com>, Trevor Gross <tmgross@...ch.edu>, Danilo Krummrich <dakr@...nel.org>, Greg Kroah-Hartman <gregkh@...uxfoundation.org>, "Rafael J. Wysocki" <rafael@...nel.org>, Brendan Higgins <brendan.higgins@...ux.dev>, David Gow <davidgow@...gle.com>, Rae Moar <rmoar@...gle.com>, Bjorn Helgaas <bhelgaas@...gle.com>, Luis Chamberlain <mcgrof@...nel.org>, Russ Weight <russ.weight@...ux.dev>, Rob Herring <robh@...nel.org>, Saravana Kannan <saravanak@...gle.com>, linux-kbuild@...r.kernel.org, linux-kernel@...r.kernel.org, rust-for-linux@...r.kernel.org, linux-kselftest@...r.kernel.org, kunit-dev@...glegroups.com,
	linux-pci@...r.kernel.org, linux-block@...r.kernel.org, devicetree@...r.kernel.org
Subject: Re: [PATCH v2 2/5] rust: enable `clippy::ptr_as_ptr` lint

On Wed Mar 12, 2025 at 4:18 PM CET, Tamir Duberstein wrote:
> On Wed, Mar 12, 2025 at 10:40 AM Benno Lossin <benno.lossin@...ton.me> wrote:
>>
>> On Sun Mar 9, 2025 at 5:00 PM CET, Tamir Duberstein wrote:
>> > In Rust 1.51.0, Clippy introduced the `ptr_as_ptr` lint [1]:
>> >
>> >> Though `as` casts between raw pointers are not terrible,
>> >> `pointer::cast` is safer because it cannot accidentally change the
>> >> pointer's mutability, nor cast the pointer to other types like `usize`.
>> >
>> > There are a few classes of changes required:
>> > - Modules generated by bindgen are marked
>> >   `#[allow(clippy::ptr_as_ptr)]`.
>> > - Inferred casts (` as _`) are replaced with `.cast()`.
>> > - Ascribed casts (` as *... T`) are replaced with `.cast::<T>()`.
>> > - Multistep casts from references (` as *const _ as *const T`) are
>> >   replaced with `let x: *const _ = &x;` and `.cast()` or `.cast::<T>()`
>>
>> Similarly to the other patch, this could be `let x = &raw x;`. (but it's
>> fine to leave it as-is for now, we can also make that a
>> good-first-issue.)
>
> Yeah, same as the other patch; we can't directly do that here without
> introducing some compiler infra or bumping MSRV.

I think it's fine enabling the feature for this patch (or in a prior
one) if you want to do the work. But someone already took up the issue I
created, so maybe it's best to let them handle it.

---
Cheers,
Benno


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ