[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <202509251657.F4ED4CF@keescook>
Date: Thu, 25 Sep 2025 17:00:30 -0700
From: Kees Cook <kees@...nel.org>
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: Alejandro Colomar <alx@...nel.org>, linux-kernel@...r.kernel.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>
Subject: Re: [PATCH v1 0/3] Add ENDOF(), and use it to fix off-by-one bugs
On Thu, Sep 25, 2025 at 01:48:14PM -0700, Andrew Morton wrote:
> Patchset seems reasonable, I guess. But I'm not loving "ENDOF". End
> of what - is that like __etext? "ARRAY_END" matches "ARRAY_SIZE" quite
> nicely, no? And it much better describes what the thing does.
And it's really ARRAY_BEYOND. ;) I don't really like having APIs that
require holding pointers that are actively invalid, either.
u8 array[10];
u8 *first = array; // valid address
u8 *last = &array[ARRAY_SIZE(array) - 1]; // valid address
for (u8 *c = first; c <= last; c++)
putc(*c);
// c would now be invalid but has left scope so it cannot be used
--
Kees Cook
Powered by blists - more mailing lists