[PATCH] mm/damon/core: verify found biggest system ram
From: SeongJae Park
Date: Tue Mar 17 2026 - 02:32:48 EST
On 32 bit systems having PAE (>4 GiB physical memory address sapce), the
final start and end address could overflow, resulting in returning an
invalid address range. Verify the returning region. Also remove the
resource validation after walk_system_ram_res(), since the validation
means not a lot.
Signed-off-by: SeongJae Park <sj@xxxxxxxxxx>
---
mm/damon/core.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/mm/damon/core.c b/mm/damon/core.c
index f9854aedc42d1..339325e1096bc 100644
--- a/mm/damon/core.c
+++ b/mm/damon/core.c
@@ -3089,11 +3089,10 @@ static bool damon_find_biggest_system_ram(unsigned long *start,
struct resource res = {};
walk_system_ram_res(0, -1, &res, walk_system_ram);
- if (res.end < res.start)
- return false;
-
*start = damon_res_to_core_addr(res.start, addr_unit);
*end = damon_res_to_core_addr(res.end + 1, addr_unit);
+ if (*end <= *start)
+ return false;
return true;
}
--
2.47.3