Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

mm: use ARRAY_END() instead of open-coding it

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.

Link: https://lkml.kernel.org/r/2335917d123891fec074ab1b3acfb517cf14b5a7.1765449750.git.alx@kernel.org
Signed-off-by: Alejandro Colomar <alx@kernel.org>
Cc: Kees Cook <kees@kernel.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Alexander Potapenko <glider@google.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Christopher Bazley <chris.bazley.wg14@gmail.com>
Cc: Dmitriy Vyukov <dvyukov@google.com>
Cc: Jann Horn <jannh@google.com>
Cc: Maciej W. Rozycki <macro@orcam.me.uk>
Cc: Marco Elver <elver@google.com>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

Alejandro Colomar and committed by
Andrew Morton
61e9210e a9e5620c

+3 -3
+1 -1
mm/kmemleak.c
··· 510 510 { 511 511 unsigned long flags; 512 512 513 - if (object < mem_pool || object >= mem_pool + ARRAY_SIZE(mem_pool)) { 513 + if (object < mem_pool || object >= ARRAY_END(mem_pool)) { 514 514 kmem_cache_free(object_cache, object); 515 515 return; 516 516 }
+2 -2
mm/memcontrol-v1.c
··· 1794 1794 1795 1795 mem_cgroup_flush_stats(memcg); 1796 1796 1797 - for (stat = stats; stat < stats + ARRAY_SIZE(stats); stat++) { 1797 + for (stat = stats; stat < ARRAY_END(stats); stat++) { 1798 1798 seq_printf(m, "%s=%lu", stat->name, 1799 1799 mem_cgroup_nr_lru_pages(memcg, stat->lru_mask, 1800 1800 false)); ··· 1805 1805 seq_putc(m, '\n'); 1806 1806 } 1807 1807 1808 - for (stat = stats; stat < stats + ARRAY_SIZE(stats); stat++) { 1808 + for (stat = stats; stat < ARRAY_END(stats); stat++) { 1809 1809 1810 1810 seq_printf(m, "hierarchical_%s=%lu", stat->name, 1811 1811 mem_cgroup_nr_lru_pages(memcg, stat->lru_mask,