[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <A17C0418-E304-43DF-A6AB-0F142D7B8764@kernel.org>
Date: Thu, 11 Dec 2025 08:18:56 +0900
From: Kees Cook <kees@...nel.org>
To: Alejandro Colomar <alx@...nel.org>, linux-kernel@...r.kernel.org,
linux-mm@...ck.org
CC: 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>,
Andrew Morton <akpm@...ux-foundation.org>,
"Maciej W. Rozycki" <macro@...am.me.uk>
Subject: Re: [PATCH v5 4/4] mm: Use ARRAY_END() instead of open-coding it
On December 11, 2025 7:46:49 AM GMT+09:00, Alejandro Colomar <alx@...nel.org> wrote:
>Cc: Kees Cook <kees@...nel.org>
>Cc: Linus Torvalds <torvalds@...ux-foundation.org>
>Signed-off-by: Alejandro Colomar <alx@...nel.org>
Hm, this seems to be missing a commit log body?
Are there other open-coded instances that could be replaced? This seems like a great task for a coccinelle script.
-Kees
>---
> mm/kmemleak.c | 2 +-
> mm/memcontrol-v1.c | 4 ++--
> 2 files changed, 3 insertions(+), 3 deletions(-)
>
>diff --git a/mm/kmemleak.c b/mm/kmemleak.c
>index 1ac56ceb29b6..fe33f2edfe07 100644
>--- a/mm/kmemleak.c
>+++ b/mm/kmemleak.c
>@@ -510,7 +510,7 @@ static void mem_pool_free(struct kmemleak_object *object)
> {
> unsigned long flags;
>
>- if (object < mem_pool || object >= mem_pool + ARRAY_SIZE(mem_pool)) {
>+ if (object < mem_pool || object >= ARRAY_END(mem_pool)) {
> kmem_cache_free(object_cache, object);
> return;
> }
>diff --git a/mm/memcontrol-v1.c b/mm/memcontrol-v1.c
>index 6eed14bff742..b2f37bd939fa 100644
>--- a/mm/memcontrol-v1.c
>+++ b/mm/memcontrol-v1.c
>@@ -1794,7 +1794,7 @@ static int memcg_numa_stat_show(struct seq_file *m, void *v)
>
> mem_cgroup_flush_stats(memcg);
>
>- for (stat = stats; stat < stats + ARRAY_SIZE(stats); stat++) {
>+ for (stat = stats; stat < ARRAY_END(stats); stat++) {
> seq_printf(m, "%s=%lu", stat->name,
> mem_cgroup_nr_lru_pages(memcg, stat->lru_mask,
> false));
>@@ -1805,7 +1805,7 @@ static int memcg_numa_stat_show(struct seq_file *m, void *v)
> seq_putc(m, '\n');
> }
>
>- for (stat = stats; stat < stats + ARRAY_SIZE(stats); stat++) {
>+ for (stat = stats; stat < ARRAY_END(stats); stat++) {
>
> seq_printf(m, "hierarchical_%s=%lu", stat->name,
> mem_cgroup_nr_lru_pages(memcg, stat->lru_mask,
--
Kees Cook
Powered by blists - more mailing lists