mirror-linux/drivers/of
Dan Carpenter 315ae63050 of: dynamic: Fix potential memory leak in of_changeset_action()
commit 55e95bfccf 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: 914d9d831e ("of: dynamic: Refactor action prints to not use "%pOF" inside devtree_lock")
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/r/202309011059.EOdr4im9-lkp@intel.com/
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://lore.kernel.org/r/7dfaf999-30ad-491c-9615-fb1138db121c@moroto.mountain
Signed-off-by: Rob Herring <robh@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-10-10 22:00:44 +02:00
..
unittest-data
Kconfig
Makefile
address.c of/address: Return an error when no valid dma-ranges are found 2023-02-14 19:11:42 +01:00
base.c
device.c of: Fix modalias string generation 2023-05-11 23:03:28 +09:00
dynamic.c of: dynamic: Fix potential memory leak in of_changeset_action() 2023-10-10 22:00:44 +02:00
fdt.c
fdt_address.c
irq.c
kexec.c mm,ima,kexec,of: use memblock_free_late from ima_free_kexec_buffer 2023-08-30 16:11:06 +02:00
kobj.c
of_numa.c
of_private.h
of_reserved_mem.c of: reserved_mem: Have kmemleak ignore dynamically allocated reserved mem 2023-02-22 12:59:46 +01:00
overlay.c of: overlay: Call of_changeset_init() early 2023-09-13 09:42:44 +02:00
pdt.c
platform.c treewide: Fix probing of devices in DT overlays 2023-09-13 09:43:05 +02:00
property.c of: property: fw_devlink: Add a devlink for panel followers 2023-09-13 09:43:04 +02:00
resolver.c
unittest.c of: unittest: Fix overlay type in apply/revert check 2023-09-13 09:42:44 +02:00