From: Wei Yang <richard.weiyang@gmail.com>
To: rppt@kernel.org, akpm@linux-foundation.org
Cc: linux-mm@kvack.org, Wei Yang <richard.weiyang@gmail.com>,
Pavel Tatashin <pasha.tatashin@oracle.com>
Subject: [PATCH] mm/sparse: guard the size of mem_section is power of 2
Date: Tue, 16 Apr 2024 01:25:59 +0000 [thread overview]
Message-ID: <20240416012559.4536-1-richard.weiyang@gmail.com> (raw)
We usually have this check, while commit 2a3cb8baef71 ("mm/sparse:
delete old sparse_init and enable new one") missed to take it.
Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
CC: Pavel Tatashin <pasha.tatashin@oracle.com>
---
mm/sparse.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/mm/sparse.c b/mm/sparse.c
index aed0951b87fa..a7d92fe7be19 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();
--
2.34.1
next reply other threads:[~2024-04-16 1:26 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-16 1:25 Wei Yang [this message]
2024-04-16 4:55 ` Oscar Salvador
2024-04-16 15:20 ` Pasha Tatashin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240416012559.4536-1-richard.weiyang@gmail.com \
--to=richard.weiyang@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=linux-mm@kvack.org \
--cc=pasha.tatashin@oracle.com \
--cc=rppt@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox