From: Tianyi Chen <hi@tychen.cc>
To: Mike Rapoport <rppt@kernel.org>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: [PATCH v2 4/4] memblock: initialize the region merge end index
Date: Wed, 23 Sep 2026 11:31:26 +0900 [thread overview]
Message-ID: <20260923023126.1910311-5-hi@tychen.cc> (raw)
In-Reply-To: <20260923023126.1910311-1-hi@tychen.cc>
GCC 13 reports that end_rgn may be used uninitialized when building the
memblock simulator with BUILD=32 and its default sanitizer flags.
Every insertion sets end_rgn, and the nr_new check prevents merging when
there were no insertions, so this is not an uninitialized read. Initialize
the index to zero to avoid the warning without disabling the diagnostic.
Reported-by: Mike Rapoport <rppt@kernel.org>
Link: https://lore.kernel.org/r/179007180279.508753.4595268983388589280.b4-review@b4
Assisted-by: LLM
Signed-off-by: Tianyi Chen <hi@tychen.cc>
---
mm/memblock.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mm/memblock.c b/mm/memblock.c
index 22d14a637f24..aee1fe36130b 100644
--- a/mm/memblock.c
+++ b/mm/memblock.c
@@ -614,7 +614,7 @@ static int __init_memblock memblock_add_range(struct memblock_type *type,
bool insert = false;
phys_addr_t obase = base;
phys_addr_t end = base + memblock_cap_size(base, &size);
- int idx, nr_new, start_rgn = -1, end_rgn;
+ int idx, nr_new, start_rgn = -1, end_rgn = 0;
struct memblock_region *rgn;
if (!size)
--
2.55.0
next prev parent reply other threads:[~2026-09-23 2:32 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-23 2:31 [PATCH v2 0/4] memblock tests: fix BUILD=32 address conversions and warnings Tianyi Chen
2026-09-23 2:31 ` [PATCH v2 1/4] memblock tests: use physical addresses for region removal Tianyi Chen
2026-09-23 2:31 ` [PATCH v2 2/4] memblock tests: zero-extend simulated memory addresses Tianyi Chen
2026-09-23 2:31 ` [PATCH v2 3/4] tools: use __pa() in virt_to_phys() Tianyi Chen
2026-09-23 2:31 ` Tianyi Chen [this message]
2026-09-24 7:57 ` [PATCH v2 0/4] memblock tests: fix BUILD=32 address conversions and warnings Mike Rapoport
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=20260923023126.1910311-5-hi@tychen.cc \
--to=hi@tychen.cc \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--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