public inbox for linux-mm@kvack.org
 help / color / mirror / Atom feed
* [PATCH 0/2] mm/damon/reclaim: fix addr_unit validation and age truncation
@ 2026-03-19 16:16 Josh Law
  2026-03-19 16:16 ` [PATCH 1/2] mm/damon/reclaim: reject non-power-of-2 addr_unit Josh Law
  2026-03-19 16:16 ` [PATCH 2/2] mm/damon/reclaim: fix min_age_region truncation from unsigned long to unsigned int Josh Law
  0 siblings, 2 replies; 5+ messages in thread
From: Josh Law @ 2026-03-19 16:16 UTC (permalink / raw)
  To: sj, akpm; +Cc: damon, linux-mm, linux-kernel, Josh Law

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



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-03-20  2:48 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-19 16:16 [PATCH 0/2] mm/damon/reclaim: fix addr_unit validation and age truncation Josh Law
2026-03-19 16:16 ` [PATCH 1/2] mm/damon/reclaim: reject non-power-of-2 addr_unit Josh Law
2026-03-20  2:29   ` SeongJae Park
2026-03-19 16:16 ` [PATCH 2/2] mm/damon/reclaim: fix min_age_region truncation from unsigned long to unsigned int Josh Law
2026-03-20  2:48   ` SeongJae Park

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox