[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CANiq72mnT73Mb7RJhZjf4de=_Orv4pipunMhOersOj_aqrFA-g@mail.gmail.com>
Date: Wed, 19 Mar 2025 17:06:39 +0100
From: Miguel Ojeda <miguel.ojeda.sandonis@...il.com>
To: Tamir Duberstein <tamird@...il.com>
Cc: Benno Lossin <benno.lossin@...ton.me>, Andrew Ballance <andrewjballance@...il.com>, dakr@...nel.org,
airlied@...il.com, simona@...ll.ch, maarten.lankhorst@...ux.intel.com,
mripard@...nel.org, tzimmermann@...e.de, corbet@....net, ojeda@...nel.org,
alex.gaynor@...il.com, boqun.feng@...il.com, gary@...yguo.net,
bjorn3_gh@...tonmail.com, a.hindborg@...nel.org, aliceryhl@...gle.com,
tmgross@...ch.edu, acourbot@...dia.com, nouveau@...ts.freedesktop.org,
dri-devel@...ts.freedesktop.org, linux-doc@...r.kernel.org,
linux-kernel@...r.kernel.org, rust-for-linux@...r.kernel.org
Subject: Re: [PATCH v2 2/3] rust: alloc: add Vec::resize method
On Wed, Mar 19, 2025 at 4:59 PM Tamir Duberstein <tamird@...il.com> wrote:
>
> If we're talking about the same thing then I think we're both wrong
> and the correct phrasing would have been: "you can avoid underflow
> checking when CONFIG_RUST_OVERFLOW_CHECKS=y by using `checked_sub`". I
> was referring to the underflow check implicit in `new_len -
> self.len()`.
`checked_sub` always checks (if not optimized away). The config option
is about the implicit one.
Do you mean avoiding panics?
Cheers,
Miguel
Powered by blists - more mailing lists