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 for Android: free password hash cracker in your pocket
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250326012434.918844-1-ye.liu@linux.dev>
Date: Wed, 26 Mar 2025 09:24:34 +0800
From: Ye Liu <ye.liu@...ux.dev>
To: akpm@...ux-foundation.org
Cc: linux-mm@...ck.org,
	linux-kernel@...r.kernel.org,
	anshuman.khandual@....com,
	Ye Liu <liuye@...inos.cn>
Subject: [PATCH v3] mm/page_alloc: Simplify free_page_is_bad by removing free_page_is_bad_report

From: Ye Liu <liuye@...inos.cn>

Refactors the free_page_is_bad function by directly calling bad_page() 
instead of using the intermediary function free_page_is_bad_report(). 
The removal of free_page_is_bad_report() reduces unnecessary indirection,
making the code cleaner and easier to read.

The functionality remains the same, as free_page_is_bad_report() was
merely a wrapper for the bad_page() call. The patch also improves
maintainability by reducing the function call depth.

Signed-off-by: Ye Liu <liuye@...inos.cn>
Reviewed-by: Anshuman Khandual <anshuman.khandual@....com>

---
V3: Delete 'This patch'.
V2: Simplify the code by removing unnecessary line breaks.
---
---
 mm/page_alloc.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 61d6a3b1b286..60c54ba78a11 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -933,19 +933,13 @@ static const char *page_bad_reason(struct page *page, unsigned long flags)
 	return bad_reason;
 }
 
-static void free_page_is_bad_report(struct page *page)
-{
-	bad_page(page,
-		 page_bad_reason(page, PAGE_FLAGS_CHECK_AT_FREE));
-}
-
 static inline bool free_page_is_bad(struct page *page)
 {
 	if (likely(page_expected_state(page, PAGE_FLAGS_CHECK_AT_FREE)))
 		return false;
 
 	/* Something has gone sideways, find it */
-	free_page_is_bad_report(page);
+	bad_page(page, page_bad_reason(page, PAGE_FLAGS_CHECK_AT_FREE));
 	return true;
 }
 
-- 
2.25.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ