Re: [PATCH 3/4] mm: kmemleak: factor leak confirmation into a helper

From: Catalin Marinas

Date: Wed Aug 12 2026 - 05:15:47 EST


On Mon, Jul 13, 2026 at 04:48:06AM -0700, Breno Leitao wrote:
> The reporting loop in kmemleak_scan() decided whether to tag an object as
> a reported leak with a four-term compound condition whose last operand
> also had a side effect (++object->unref_scans). Mixing the candidate
> tests with the counter update made the check hard to read.
>
> Move the state transition into confirm_leak(): it returns true when a
> still-unreferenced suspect crosses min_unref_scans consecutive scans and
> is newly flagged OBJECT_REPORTED, leaving only the reporting bookkeeping
> in the caller. No functional change.
>
> Signed-off-by: Breno Leitao <leitao@xxxxxxxxxx>

Reviewed-by: Catalin Marinas <catalin.marinas@xxxxxxx>