aboutsummaryrefslogtreecommitdiffstats
path: root/mm/sparse.c
diff options
context:
space:
mode:
authorWei Yang <[email protected]>2024-04-16 01:25:59 +0000
committerAndrew Morton <[email protected]>2024-05-06 00:53:40 +0000
commit122ff80e12b3aa586d702b7fb651a99d443e7777 (patch)
tree42829920f2980eca95d987e4288c6779783a7224 /mm/sparse.c
parentdoc: split buffer.rst out of api-summary.rst (diff)
downloadkernel-122ff80e12b3aa586d702b7fb651a99d443e7777.tar.gz
kernel-122ff80e12b3aa586d702b7fb651a99d443e7777.zip
mm/sparse: guard the size of mem_section is power of 2
We usually have this check, while commit 2a3cb8baef71 ("mm/sparse: delete old sparse_init and enable new one") missed to take it. Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Wei Yang <[email protected]> Acked-by: Oscar Salvador <[email protected]> Reviewed-by: Pasha Tatashin <[email protected]> Cc: "Mike Rapoport (IBM)" <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
Diffstat (limited to 'mm/sparse.c')
-rw-r--r--mm/sparse.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/mm/sparse.c b/mm/sparse.c
index 46e88549d1a6..de40b2c73406 100644
--- a/mm/sparse.c
+++ b/mm/sparse.c
@@ -560,6 +560,8 @@ void __init sparse_init(void)
unsigned long pnum_end, pnum_begin, map_count = 1;
int nid_begin;
+ /* see include/linux/mmzone.h 'struct mem_section' definition */
+ BUILD_BUG_ON(!is_power_of_2(sizeof(struct mem_section)));
memblocks_present();
pnum_begin = first_present_section_nr();