clk: vc5: check memory returned by kasprintf()
authorClaudiu Beznea <claudiu.beznea@microchip.com>
Tue, 30 May 2023 09:39:06 +0000 (12:39 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 19 Jul 2023 14:21:32 +0000 (16:21 +0200)
commit0b5c9e9695f8fc00befbad3c317de3dc783bd0b8
tree822db256d92aff86e8f8d0e32f5b757b10e6c2b8
parentaf8affd12375f01905977780d7f98ee83e22ded3
clk: vc5: check memory returned by kasprintf()

[ Upstream commit 144601f6228de5598f03e693822b60a95c367a17 ]

kasprintf() returns a pointer to dynamically allocated memory.
Pointer could be NULL in case allocation fails. Check pointer validity.
Identified with coccinelle (kmerr.cocci script).

Fixes: f491276a5168 ("clk: vc5: Allow Versaclock driver to support multiple instances")
Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
Link: https://lore.kernel.org/r/20230530093913.1656095-2-claudiu.beznea@microchip.com
Reviewed-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/clk/clk-versaclock5.c