Skip to content

Commit b73ed98

Browse files
claudiubezneabebarino
authored andcommitted
clk: keystone: sci-clk: check return value of kasprintf()
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: b745c07 ("clk: keystone: Add sci-clk driver support") Depends-on: 96488c0 ("clk: keystone: sci-clk: cut down the clock name length") Signed-off-by: Claudiu Beznea <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Tony Lindgren <[email protected]> Signed-off-by: Stephen Boyd <[email protected]>
1 parent 267ad94 commit b73ed98

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

drivers/clk/keystone/sci-clk.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,8 @@ static int _sci_clk_build(struct sci_clk_provider *provider,
294294

295295
name = kasprintf(GFP_KERNEL, "clk:%d:%d", sci_clk->dev_id,
296296
sci_clk->clk_id);
297+
if (!name)
298+
return -ENOMEM;
297299

298300
init.name = name;
299301

0 commit comments

Comments
 (0)