From: sashiko-bot@kernel.org
To: "SJ Park" <sj@kernel.org>
Cc: "Andrew Morton" <akpm@linux-foundation.org>,
damon@lists.linux.dev, linux-mm@kvack.org
Subject: Re: [RFC PATCH] mm/damon/core: filter out damos address filter-split failed region
Date: Sun, 18 Oct 2026 22:11:06 +0000 [thread overview]
Message-ID: <sashiko-outbox-176425@kernel.org> (raw)
In-Reply-To: <20261018220253.158238-1-sj@kernel.org>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] mm/damon: unchecked damon_split_region_at() error in damos_filter_match()
--
commit 881e287348e01011e3ec5442e7deb6f9c112db9c
Author: SJ Park <sj@kernel.org>
mm/damon/core: filter out damos address filter-split failed region
This commit updates damos_filter_match() and damos_core_filter_out() to
propagate errors from damon_split_region_at() and filter out the region if
splitting fails during DAMOS_FILTER_TYPE_ADDR evaluation.
> diff --git a/mm/damon/core.c b/mm/damon/core.c
> index b63e60ef89901..4d34587387456 100644
> --- a/mm/damon/core.c
> +++ b/mm/damon/core.c
> @@ -2551,13 +2551,14 @@ static void damos_update_stat(struct damos *s,
>
> static bool damos_filter_match(struct damon_ctx *ctx, struct damon_target *t,
> struct damon_region *r, struct damos_filter *filter,
> - unsigned long min_region_sz)
> + unsigned long min_region_sz, int *err)
> {
> bool matched = false;
> struct damon_target *ti;
> int target_idx = 0;
> unsigned long start, end, wsum;
>
> + *err = 0;
> switch (filter->type) {
> case DAMOS_FILTER_TYPE_TARGET:
> damon_for_each_target(ti, ctx) {
> @@ -2588,7 +2589,9 @@ static bool damos_filter_match(struct damon_ctx *ctx, struct damon_target *t,
> break;
> }
> /* start inside the range */
> - damon_split_region_at(t, r, end - r->ar.start);
> + *err = damon_split_region_at(t, r, end - r->ar.start);
> + if (*err)
> + return false;
> matched = true;
> break;
[Severity: Medium]
Should the earlier damon_split_region_at() call in damos_filter_match()
when r->ar.start < start also propagate its return value via *err?
mm/damon/core.c:damos_filter_match() {
case DAMOS_FILTER_TYPE_ADDR:
...
/* start before the range and overlap */
if (r->ar.start < start) {
damon_split_region_at(t, r, start - r->ar.start);
matched = false;
break;
}
}
When a region starts before the filter range and overlaps it (r->ar.start <
start and r->ar.end > start), if damon_split_region_at(t, r, start -
r->ar.start) fails with -ENOMEM, r remains unsplit across [r->ar.start,
r->ar.end) while matched is set to false and *err remains 0.
If the filter is configured to exclude [start, end) (for example,
filter->matching == true and filter->allow == false with
s->core_filters_default_reject == false, or filter->matching == false and
filter->allow == true), kdamond_apply_schemes() -> damos_apply_scheme() ->
damos_core_filter_out() sees err == 0, does not reject r, and proceeds to
call c->ops.apply_scheme() on the entire unsplit region including the
excluded address range.
[ ... ]
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261018220253.158238-1-sj@kernel.org?part=1
next prev parent reply other threads:[~2026-10-18 22:11 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-18 22:02 [RFC PATCH] mm/damon/core: filter out damos address filter-split failed region SJ Park
2026-10-18 22:11 ` sashiko-bot [this message]
2026-10-18 22:13 ` SJ Park
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=sashiko-outbox-176425@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=damon@lists.linux.dev \
--cc=linux-mm@kvack.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=sj@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox