Skip to content
Snippets Groups Projects
Commit 464f64c9 authored by Dan Carpenter's avatar Dan Carpenter Committed by Frieder Schrempf
Browse files

of: dynamic: Fix potential memory leak in of_changeset_action()


commit 55e95bfc upstream.

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.

Note that there is not any actual problem with upstream kernels. All
callers of of_changeset_action() are static inlines with fixed action
values.

Fixes: 914d9d83 ("of: dynamic: Refactor action prints to not use "%pOF" inside devtree_lock")
Reported-by: default avatarkernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/r/202309011059.EOdr4im9-lkp@intel.com/


Signed-off-by: default avatarDan Carpenter <dan.carpenter@linaro.org>
Reviewed-by: default avatarGeert Uytterhoeven <geert+renesas@glider.be>
Link: https://lore.kernel.org/r/7dfaf999-30ad-491c-9615-fb1138db121c@moroto.mountain


Signed-off-by: default avatarRob Herring <robh@kernel.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent ef1b2209
No related branches found
No related tags found
1 merge request!102🤖 Sync Bot: Update v5.10-ktn to Latest Stable Kernel (v5.10.198)
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment