Re: [PATCH] selftests/mm: Fix memleak in migration benchmark

From: SJ Park

Date: Wed Jul 08 2026 - 21:10:24 EST


On Wed, 8 Jul 2026 18:37:05 +0800 Hongfu Li <lihongfu@xxxxxxxxxx> wrote:

> Several early return paths in run_migration_benchmark() skip
> hmm_buffer_free(), leaking the buffer. Replace with a single cleanup
> label.

Looks good to me.

>
> Signed-off-by: Hongfu Li <lihongfu@xxxxxxxxxx>

As David suggested, having Fixes: would be nice. Seems 271a7b2e3c13
("selftests/mm/hmm-tests: new throughput tests including THP") could be the
one?

Reviewed-by: SJ Park <sj@xxxxxxxxxx>

[...]
>
> /* Cleanup */
> +cleanup:
> hmm_buffer_free(buffer);
> - return 0;
> + return ret;

A trivial nit. I think '/* Cleanup */' doesn't really need to be stayed there,
as the 'cleanup:' label self-explains what it is doing here.


Thanks,
SJ

[...]