summaryrefslogtreecommitdiff
path: root/mm/damon/ops-common.c
diff options
context:
space:
mode:
Diffstat (limited to 'mm/damon/ops-common.c')
-rw-r--r--mm/damon/ops-common.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/mm/damon/ops-common.c b/mm/damon/ops-common.c
index 5c93ef2bb8a9..d1842e2b00ef 100644
--- a/mm/damon/ops-common.c
+++ b/mm/damon/ops-common.c
@@ -143,6 +143,7 @@ int damon_hot_score(struct damon_ctx *c, struct damon_region *r,
* Transform it to fit in [0, DAMOS_MAX_SCORE]
*/
hotness = hotness * DAMOS_MAX_SCORE / DAMON_MAX_SUBSCORE;
+ hotness = max(min(hotness, DAMOS_MAX_SCORE), 0);
return hotness;
}