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

From: Hongfu Li

Date: Wed Jul 08 2026 - 22:03:27 EST


Hi,

> > 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 a lot for your review and suggestions.

I'll add the Fixes tag referencing commit 271a7b2e3c13 and drop the
redundant comment in the next version.

Best regards,
Hongfu