Re: [PATCH] of: dynamic: Fix potential memory leak in of_changeset_action()

From: Rob Herring
Date: Mon Sep 11 2023 - 18:07:03 EST



On Fri, 08 Sep 2023 10:03:50 +0300, Dan Carpenter wrote:
> Smatch complains that the error path where "action" is invalid leaks
> the "ce" allocation:
> drivers/of/dynamic.c:935 of_changeset_action()
> warn: possible memory leak of 'ce'
>
> Fix this by doing the validation before the allocation.
>
> Fixes: 914d9d831e61 ("of: dynamic: Refactor action prints to not use "%pOF" inside devtree_lock")
> Reported-by: kernel test robot <lkp@xxxxxxxxx>
> Closes: https://lore.kernel.org/r/202309011059.EOdr4im9-lkp@xxxxxxxxx/
> Signed-off-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
> ---
> drivers/of/dynamic.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>

Applied, thanks!