diff --git a/mm/damon/core.c b/mm/damon/core.c index 3e221c888e30..4ab1ed472fbc 100644 --- a/mm/damon/core.c +++ b/mm/damon/core.c @@ -215,6 +215,12 @@ int damon_set_regions(struct damon_target *t, struct damon_addr_range *ranges, unsigned int i; int err; + for (i = 0; i < nr_ranges; i++) { + if (ALIGN_DOWN(ranges[i].start, min_sz_region) >= + ALIGN(ranges[i].end, min_sz_region)) + return -EINVAL; + } + /* Remove regions which are not in the new ranges */ damon_for_each_region_safe(r, next, t) { for (i = 0; i < nr_ranges; i++) {