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: <20250326210400.695960-1-andrewjballance@gmail.com>
Date: Wed, 26 Mar 2025 16:04:00 -0500
From: Andrew Ballance <andrewjballance@...il.com>
To: remo@...nzli.dev
Cc: a.hindborg@...nel.org,
	alex.gaynor@...il.com,
	aliceryhl@...gle.com,
	andriy.shevchenko@...ux.intel.com,
	benno.lossin@...ton.me,
	bjorn3_gh@...tonmail.com,
	boqun.feng@...il.com,
	dakr@...nel.org,
	devicetree@...r.kernel.org,
	dirk.behme@...bosch.com,
	djrscally@...il.com,
	gary@...yguo.net,
	gregkh@...uxfoundation.org,
	heikki.krogerus@...ux.intel.com,
	linux-acpi@...r.kernel.org,
	linux-kernel@...r.kernel.org,
	ojeda@...nel.org,
	rafael@...nel.org,
	robh@...nel.org,
	rust-for-linux@...r.kernel.org,
	sakari.ailus@...ux.intel.com,
	saravanak@...gle.com,
	tmgross@...ch.edu,
	andrewjballance@...il.com
Subject: Re: [PATCH 06/10] rust: property: Add child accessor and iterator

On Wed, Mar 26, 2025 at 12:13 PM Remo Senekowitsch Wrote: 
>  impl FwNode {
> +    // SAFETY: `raw` must have its refcount incremented.
> +    unsafe fn from_raw(raw: *mut bindings::fwnode_handle) -> ARef<Self> {
> +        unsafe { ARef::from_raw(ptr::NonNull::new_unchecked(raw.cast())) }
> +    }

this safety comment should say why it is ok to cast from a
struct fwnode_handle* to a *const FwNode

> +                    // We will pass `prev` to `fwnode_get_next_child_node`,
> +                    // which decrements its refcount, so we use
> +                    // `ARef::into_raw` to avoid decrementing the refcount
> +                    // twice.
> +                    let prev = ARef::into_raw(prev);
> +                    prev.as_ptr().cast()
> +                }
> +            };
> +            let next = unsafe { bindings::fwnode_get_next_child_node(self.as_raw(), prev_ptr) };

this is missing a safety comment

> +            if next.is_null() {
> +                return None;
> +            }

Andrew

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ