[PATCH 0/2] mm/damon/reclaim: fix addr_unit validation and age truncation

From: Josh Law

Date: Thu Mar 19 2026 - 12:34:25 EST


Two small fixes for mm/damon/reclaim.c:

Patch 1 rejects non-power-of-2 addr_unit values in the store function.
Without this, DAMON_MIN_REGION_SZ / addr_unit produces a non-power-of-2
min_region_sz that causes undefined behavior in ALIGN() before
damon_commit_ctx() gets a chance to reject it. Note that
mm/damon/lru_sort.c has the same pattern and likely needs a similar fix.

Patch 2 clamps the min_age / aggr_interval result to UINT_MAX to prevent
silent truncation when assigning to the unsigned int min_age_region field.

Josh Law (2):
mm/damon/reclaim: reject non-power-of-2 addr_unit
mm/damon/reclaim: fix min_age_region truncation from unsigned long to
unsigned int

mm/damon/reclaim.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

--
2.34.1