[PATCH] mtd: rawnand: atmel: Fix possible memory leak

Miquel Raynal miquel.raynal at bootlin.com
Mon Oct 21 03:02:55 PDT 2024


On Tue, 2024-10-01 at 20:31:49 UTC, Miquel Raynal wrote:
> The pmecc "user" structure is allocated in atmel_pmecc_create_user() and
> was supposed to be freed with atmel_pmecc_destroy_user(), but this other
> helper is never called. One solution would be to find the proper
> location to call the destructor, but the trend today is to switch to
> device managed allocations, which in this case fits pretty well.
> 
> Replace kzalloc() by devm_kzalloc() and drop the destructor entirely.
> 
> Reported-by: "Dr. David Alan Gilbert" <linux at treblig.org>
> Closes: https://lore.kernel.org/all/ZvmIvRJCf6VhHvpo@gallifrey/
> Fixes: f88fc122cc34 ("mtd: nand: Cleanup/rework the atmel_nand driver")
> Signed-off-by: Miquel Raynal <miquel.raynal at bootlin.com>

Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git nand/next.

Miquel



More information about the linux-mtd mailing list