Re: [PATCH -next] mm/damon: fix error return code in damon_reclaim_turn()

From: SeongJae Park
Date: Mon Oct 25 2021 - 09:30:09 EST


On Mon, 25 Oct 2021 20:45:00 +0800 Yang Yingliang <yangyingliang@xxxxxxxxxx> wrote:

> If damon_reclaim_new_scheme() fails, it should return
> error code in damon_reclaim_turn()
>
> Reported-by: Hulk Robot <hulkci@xxxxxxxxxx>
> Signed-off-by: Yang Yingliang <yangyingliang@xxxxxxxxxx>

Thank you for this fix!

Reviewed-by: SeongJae Park <sj@xxxxxxxxxx>


Thanks,
SJ

> ---
> mm/damon/reclaim.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/mm/damon/reclaim.c b/mm/damon/reclaim.c
> index f5ae4c422555..dc1485044eaf 100644
> --- a/mm/damon/reclaim.c
> +++ b/mm/damon/reclaim.c
> @@ -292,8 +292,10 @@ static int damon_reclaim_turn(bool on)
>
> /* Will be freed by 'damon_set_schemes()' below */
> scheme = damon_reclaim_new_scheme();
> - if (!scheme)
> + if (!scheme) {
> + err = -ENOMEM;
> goto free_region_out;
> + }
> err = damon_set_schemes(ctx, &scheme, 1);
> if (err)
> goto free_scheme_out;
> --
> 2.25.1
>