Skip to contentSkip to conversation

mm-use-array_end-instead-of-open-coding-it.patch removed from -mm tree

merged mm-nonmm-stable Andrew Morton 1 participant 1 message Jan 21

lore
Share & tools
lore

Andrew Morton

author tree notice Applied
#0 lore raw

The quilt patch titled
Subject: mm: use ARRAY_END() instead of open-coding it
has been removed from the -mm tree. Its filename was
mm-use-array_end-instead-of-open-coding-it.patch

This patch was dropped because it was merged into the mm-nonmm-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

------------------------------------------------------
From: Alejandro Colomar <[email protected]>
Subject: mm: use ARRAY_END() instead of open-coding it
Date: Thu, 11 Dec 2025 11:44:04 +0100

There aren't any bugs in this code; it's purely cosmetic.

By using ARRAY_END(), we prevent future issues, in case the code is modified; it has less moving parts. Also, it should be more readable (and perhaps more importantly, greppable), as there are several ways of writing an expression that gets the end of an array, which are unified by this API name.

---

 mm/kmemleak.c      |    2 +-
 mm/memcontrol-v1.c |    4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)
mm/kmemleak.c renamed from mm/kmemleak.c~mm-use-array_end-instead-of-open-coding-it +1 -1
@@ -510,7 +510,7 @@ static void mem_pool_free(struct kmemlea
 {
 	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;
 	}
mm/memcontrol-v1.c renamed from mm/memcontrol-v1.c~mm-use-array_end-instead-of-open-coding-it +2 -2
@@ -1794,7 +1794,7 @@ static int memcg_numa_stat_show(struct s
 
 	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 s
 		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,

_

Patches currently in -mm which might be from [email protected] are