Re: [PATCH v1 1/2] overflow: Allow to sum a few arguments at once
From: Andy Shevchenko
Date: Sat Jun 20 2026 - 02:56:26 EST
On Fri, Jun 19, 2026 at 08:27:33PM -0700, Kees Cook wrote:
> 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:
...
> > > > +#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()?
For now, yes. The array_size() can be modified as we have already two of them,
but I don't remember seeing more than 3, so it might look like an unneeded
churn.
> I'm fine for this to go via whatever tree is first to use it:
>
> Acked-by: Kees Cook <kees@xxxxxxxxxx>
Thanks!
Johannes, are you okay to take a new version (I assume the wish is to have
the balanced additions)? If so, I will prepare one.
--
With Best Regards,
Andy Shevchenko