[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAH5fLgi_1H2otP-Ha2OZO+h7_7c0kHfF49aWi8fNZLb0q5FSYQ@mail.gmail.com>
Date: Wed, 14 Jan 2026 09:42:15 +0100
From: Alice Ryhl <aliceryhl@...gle.com>
To: Onur Özkan <work@...rozkan.dev>
Cc: rust-for-linux@...r.kernel.org, ojeda@...nel.org, alex.gaynor@...il.com,
boqun.feng@...il.com, gary@...yguo.net, bjorn3_gh@...tonmail.com,
lossin@...nel.org, a.hindborg@...nel.org, tmgross@...ch.edu, dakr@...nel.org,
yutaro.ono.418@...il.com, charmitro@...teo.net, borys.tyran@...tonmail.com,
daniel@...lak.dev, tamird@...il.com, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v1] rbtree: reduce unsafe blocks on pointer derefs
On Thu, Nov 13, 2025 at 3:46 PM Onur Özkan <work@...rozkan.dev> wrote:
>
> Refactors parts of the get() and cursor_lower_bound()
> traversal logic to minimize the scope of unsafe blocks
> and avoid duplicating same safety comments.
>
> One of the removed comments was also misleading:
>
> // SAFETY: `node` is a non-null node...
> Ordering::Equal => return Some(unsafe { &(*this).value }),
>
> as `node` should have been `this`.
>
> No functional changes intended; this is purely a safety
> improvement that reduces the amount of unsafe blocks
> while keeping all invariants intact.
>
> Signed-off-by: Onur Özkan <work@...rozkan.dev>
One consequence of creating a &_ to the bindings::rb_node struct means
that we assert immutability for the entire struct and not just the
rb_left/rb_right fields, but I have verified that this is ok.
Reviewed-by: Alice Ryhl <aliceryhl@...gle.com>
Powered by blists - more mailing lists