[PATCH] mm: fix a overflow in test_pages_in_a_zone()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: zhong jiang <zhongjiang@xxxxxxxxxx>

when the mailline introduce the commit a96dfddbcc04
("base/memory, hotplug: fix a kernel oops in show_valid_zones()"),
it obtains the valid start and end pfn from the given pfn range.
The valid start pfn can fix the actual issue, but it introduce
another issue. The valid end pfn will may exceed the given end_pfn.

Ahthough the incorrect overflow will not result in actual problem
at present, but I think it need to be fixed.

Signed-off-by: zhong jiang <zhongjiang@xxxxxxxxxx>
---
 mm/memory_hotplug.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
index b8c11e0..f611584 100644
--- a/mm/memory_hotplug.c
+++ b/mm/memory_hotplug.c
@@ -1521,7 +1521,7 @@ int test_pages_in_a_zone(unsigned long start_pfn, unsigned long end_pfn,
 
 	if (zone) {
 		*valid_start = start;
-		*valid_end = end;
+		*valid_end = min(end, end_pfn);
 		return 1;
 	} else {
 		return 0;
-- 
1.8.3.1

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]
  Powered by Linux