[PATCH 5/8] s390/mm: Add error handling to arch_setup_zero_pages()
From: Heiko Carstens
Date: Wed Nov 18 2026 - 09:47:54 EST
If set_memory_ro() fails early in arch_setup_zero_pages() just
panic. This should never happen.
Signed-off-by: Heiko Carstens <hca@xxxxxxxxxxxxx>
---
arch/s390/mm/init.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/arch/s390/mm/init.c b/arch/s390/mm/init.c
index be7e009e7b59..4d5a13b19dca 100644
--- a/arch/s390/mm/init.c
+++ b/arch/s390/mm/init.c
@@ -74,6 +74,7 @@ void __init arch_setup_zero_pages(void)
{
unsigned long total_pages = memblock_estimated_nr_free_pages();
unsigned int order;
+ int rc;
/* Latest machines require a mapping granularity of 512KB */
order = 7;
@@ -86,7 +87,9 @@ void __init arch_setup_zero_pages(void)
zero_page_mask = ((PAGE_SIZE << order) - 1) & PAGE_MASK;
- set_memory_ro(empty_zero_page, 1UL << order);
+ rc = set_memory_ro(empty_zero_page, 1UL << order);
+ if (rc)
+ panic("%s() failed, err = %d\n", __func__, rc);
}
void __init arch_zone_limits_init(unsigned long *max_zone_pfns)
--
2.56.1