Re: [PATCH v5 1/2] rust: kernel: create `overflow_assert!` macro
From: Antonio Hickey
Date: Sat Jun 27 2026 - 09:20:00 EST
> Hi Antonio,
>
> Someone asked about this old issue in GitHub -- let me take the chance
> to give a couple comments to resurrect this series...
Hey Miguel,
I've been getting back up to speed on this patch series.
> On Tue, Aug 19, 2025 at 2:39 AM Antonio Hickey
> <contact@xxxxxxxxxxxxxxxxx> wrote:
>> Link: https://github.com/Rust-for-Linux/linux/issues/1159
> It seems you didn't reorder the tags as mentioned in v4? Was there a
> reason for that?
I don't see any valid reason other than just naively missing this on my
end, but I'll make sure my v6 reorders the tags as mentioned.
> +/// A guard before doing a size computation that could overflow:
> +/// ```
> +/// fn reserve_for_concat(curr: usize, to_add: usize, cap: usize) {
> +/// // If enabled, catch obvious overflow logic errors early:
> +/// overflow_assert!(curr <= cap, "curr={} > cap={}", curr, cap);
> +/// overflow_assert!(to_add <= cap - curr, "would exceed cap: {}+{} > {}", curr, to_add, cap);
> +/// // ... then proceed to grow/append
> +/// }
> +/// ```
As I'm re-reviewing my patch for a v6, what are your thought's on this
example in the doc's of the macro?
My main worry is the placeholder comments make the example seem
incomplete, or are these kind of partial function examples normal?
Cheers,
Antonio Hickey