clk: Test the clock pointer in clk_hw_get_name()
authorMaxime Ripard <maxime@cerno.tech>
Tue, 5 Apr 2022 13:20:27 +0000 (15:20 +0200)
committerPhil Elwell <8911409+pelwell@users.noreply.github.com>
Fri, 22 Apr 2022 09:17:27 +0000 (10:17 +0100)
commit1a5a3768ce8ebc3819c53b6fcd92e615a990cb09
treee6079f69101e4e6871faec000db44fe87f0b9593
parentec56241b586ca68c9a45658b69034a99c20fd498
clk: Test the clock pointer in clk_hw_get_name()

Unlike __clk_get_name(), clk_hw_get_name() doesn't test wether passed
clk_hw pointer is NULL or not and dereferences it directly. This can
then lead to NULL pointer dereference.

Let's make sure the pointer isn't NULL before dereferencing it.

Tested-by: Alexander Stein <alexander.stein@ew.tq-group.com> # imx8mp
Tested-by: Marek Szyprowski <m.szyprowski@samsung.com> # exynos4210, meson g12b
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
drivers/clk/clk.c