[Cc Dave]
On Thu 23-08-18 21:07:31, Wei Yang wrote:
When CONFIG_SPARSEMEM_EXTREME is not defined, mem_section is a static
two dimension array. This means !mem_section[SECTION_NR_TO_ROOT(nr)] is
always true.
This patch expand the CONFIG_SPARSEMEM_EXTREME range to return a proper
mem_section when CONFIG_SPARSEMEM_EXTREME is not defined.
As long as all callers provide a valid section number then yes. I am not
really sure this is the case though.
quoted hunk ↗ jump to hunk
Signed-off-by: Wei Yang <redacted>
---
include/linux/mmzone.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
index 32699b2dc52a..33086f86d1a7 100644
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -1155,9 +1155,9 @@ static inline struct mem_section *__nr_to_section(unsigned long nr)
#ifdef CONFIG_SPARSEMEM_EXTREME
if (!mem_section)
return NULL;
-#endif
if (!mem_section[SECTION_NR_TO_ROOT(nr)])
return NULL;
+#endif
return &mem_section[SECTION_NR_TO_ROOT(nr)][nr & SECTION_ROOT_MASK];
}
extern int __section_nr(struct mem_section* ms);
--
2.15.1
--
Michal Hocko
SUSE Labs