linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Fix 'zone_id' may be used uninitialized in this function warning
@ 2021-07-16 21:03 Nico Pache
  0 siblings, 0 replies; only message in thread
From: Nico Pache @ 2021-07-16 21:03 UTC (permalink / raw)
  To: linux-mm, linux-kernel; +Cc: rppt, akpm, npache, aquini

When compiling with -Werror, cc1 will warn that
'zone_id' may be used uninitialized in this function warning.

Initialize the zone_id as 0.

Its safe to assume that if the code reaches this point it has at least
one numa node with memory, so no need for an assertion before
init_unavilable_range.

Fixes: 122e093c1734 ("mm/page_alloc: fix memory map initialization for descending nodes")
Signed-off-by: Nico Pache <npache@redhat.com>
---
 mm/page_alloc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 3e97e68aef7a..3f3116f52fd8 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -6719,7 +6719,7 @@ static void __init memmap_init(void)
 {
 	unsigned long start_pfn, end_pfn;
 	unsigned long hole_pfn = 0;
-	int i, j, zone_id, nid;
+	int i, j, zone_id = 0, nid;
 
 	for_each_mem_pfn_range(i, MAX_NUMNODES, &start_pfn, &end_pfn, &nid) {
 		struct pglist_data *node = NODE_DATA(nid);
-- 
2.31.1


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2021-07-16 21:04 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-16 21:03 [PATCH] Fix 'zone_id' may be used uninitialized in this function warning Nico Pache

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).