[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <aUnpiDyge6VdsnpB@devuan>
Date: Tue, 23 Dec 2025 02:07:26 +0100
From: Alejandro Colomar <alx@...nel.org>
To: Kees Cook <kees@...nel.org>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
linux-kernel@...r.kernel.org, linux-mm@...ck.org,
Christopher Bazley <chris.bazley.wg14@...il.com>, Rasmus Villemoes <linux@...musvillemoes.dk>,
Marco Elver <elver@...gle.com>, Michal Hocko <mhocko@...e.com>,
Linus Torvalds <torvalds@...ux-foundation.org>, Al Viro <viro@...iv.linux.org.uk>,
Alexander Potapenko <glider@...gle.com>, Dmitry Vyukov <dvyukov@...gle.com>, Jann Horn <jannh@...gle.com>,
"Maciej W. Rozycki" <macro@...am.me.uk>
Subject: Re: [PATCH v5 4/4] mm: Use ARRAY_END() instead of open-coding it
Hi Kees,
On Mon, Dec 22, 2025 at 03:21:21PM -0800, Kees Cook wrote:
> > Now that the first patch set has been merged, I'm working on a second
> > round.
> >
> > I've written a semantic patch:
> >
> > $ cat src/spatch/array_end.sp
> > @@
> > expression a;
> > @@
> >
> > - a + ARRAY_SIZE(a)
> > + ARRAY_END(a)
> >
> > @@
> > expression a;
> > @@
> >
> > - ARRAY_SIZE(a) + a
> > + ARRAY_END(a)
>
> I think you can add parens which will be silently removed but gain you
> the commutative behavior:
Ahhh, thanks! I was wondering how I could get commutative behavior.
> @@
> expression a;
> @@
>
> - (ARRAY_SIZE(a) + a)
> + ARRAY_END(a)
>
> I *think* that'll cover "a + ARRAY_SIZE(a)" too.
Yup, it works. :)
> Anyway, looks good!
Thanks!
> You could send it directly to Linus at the end of
> the next rc1, and he may take it.
I'll send a draft before that, just for you to review the actual patch.
> If not, you'll want to split the patch
> up and send to subsystems after ARRAY_END is in Linus's tree. I use this
> tool to split a large single patch into per-subsystem patches:
> https://github.com/kees/kernel-tools/blob/trunk/split-on-maintainer
Okay. I can do both, anyway.
Have a lovely night!
Alex
--
<https://www.alejandro-colomar.es>
Download attachment "signature.asc" of type "application/pgp-signature" (834 bytes)
Powered by blists - more mailing lists