Re: [PATCH v1 1/2] overflow: Allow to sum a few arguments at once
From: Kees Cook
Date: Fri Jun 19 2026 - 23:27:48 EST
On Fri, Jun 19, 2026 at 09:45:18AM +0300, Andy Shevchenko wrote:
> On Thu, Jun 18, 2026 at 08:47:34PM -0700, Kees Cook wrote:
> > On Wed, Jun 17, 2026 at 01:12:36PM +0200, Andy Shevchenko wrote:
> > > Convert size_add() to take variadic argument, so we can simplify users
> > > with using a macro only once.
> >
> > Oh, this is fun. I like it. :)
>
> He-he :-)
>
> ...
>
> > > +#define __size_add4(addend1, addend2, addend3, addend4, addend5, ...) \
> > > + __size_add(__size_add3(addend1, addend2, addend3, addend4), addend5)
> >
> > Is 4 the max seen in practice?
>
> In patch 2 there are 5! In cover letter I also mentioned a new user
> (there are actually three). And I remember seeing 3 somewhere else.
I feel like we should allow size_mul() to work this way too, though I
don't find any users that would need it, so I guess just size_add()?
I'm fine for this to go via whatever tree is first to use it:
Acked-by: Kees Cook <kees@xxxxxxxxxx>
--
Kees Cook