Skip to content

mm/damon/reclaim: fix addr_unit validation and age truncation

Josh Law damon linux-mm lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 2 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2mm/damon/reclaim: reject non-power-of-2 addr_unitmm/damon/reclaim.c+1 -11 reply
2/2mm/damon/reclaim: fix min_age_region truncation from unsigned long to unsigned intmm/damon/reclaim.c+2 -21 reply

Reviews trailers per patch

1 of 2 patches has a Reviewed-by or Acked-by.

PatchSeongJae Park
1/2
2/2R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

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

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(-)
Signature · 1 line
2.34.1