lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:   Mon, 19 Jun 2023 12:44:03 +0800
From:   Liam Ni <zhiguangni01@...il.com>
To:     akpm@...ux-foundation.org
Cc:     linux-mm@...ck.org, linux-kernel@...r.kernel.org, rppt@...nel.org,
        Liam Ni <zhiguangni01@...il.com>
Subject: [PATCH] mm/sparse: Check the return value of first_present_section_nr()

first_present_section_nr() may return -1,
which means there is no present section in system,or other errors,
so we cause panic here.

Signed-off-by: Liam Ni <zhiguangni01@...il.com>
---
 mm/sparse.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/mm/sparse.c b/mm/sparse.c
index b8d5d58fe240..175727e10deb 100644
--- a/mm/sparse.c
+++ b/mm/sparse.c
@@ -564,6 +564,8 @@ void __init sparse_init(void)
 	memblocks_present();
 
 	pnum_begin = first_present_section_nr();
+	if (pnum_begin == -1)
+		panic("There is no present section in system\n");
 	nid_begin = sparse_early_nid(__nr_to_section(pnum_begin));
 
 	/* Setup pageblock_order for HUGETLB_PAGE_SIZE_VARIABLE */
-- 
2.25.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ