Re: RE: [PATCH] pinctrl:sunplus: Add check for kmalloc

From: Dan Carpenter
Date: Thu May 25 2023 - 15:43:29 EST

On Thu, May 25, 2023 at 08:37:36PM +0200, Christophe JAILLET wrote:
> Hi,
> (adding Dan in copy because the initial report is related to smatch)
> I don't use kmemleak, but could you share some input about its report?
> I've not rechecked my analysis, but it looked promising.
> Maybe Dan could also give a look at it and confirm your finding, or dig
> further with smatch to make sure that its static analysis was complete
> enough.

Smatch doesn't really complain about memory leaks. I wrote that check
13 years ago and focused more on avoiding false positives instead of
being thorough. It turns out that avoiding false positives is
achievable but pretty useless.

Checking for the of_get_parent() leaks is probably easier. I could just
add it to check_unwind.c or create something custom. The heuristic for
the custom check would be to print a warning if the success path
releases it but the others don't.

dan carpenter