Quoting [email protected] (2020-07-19 07:33:24)
> From: Tom Rix <[email protected]>
> 
> clang static analysis reports this error
> 
> clk-versaclock5.c:887:3: warning: Use of memory after it is freed
>   [unix.Malloc]
>       dev_err(&client->dev, "unable to register %s\n", init.name);
>       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 
> A representative problem block of code is
> 
> ret = devm_clk_hw_register(&client->dev, &vc5->clk_mux);
> kfree(init.name);       /* clock framework made a copy of the name */
> if (ret) {
>         dev_err(&client->dev, "unable to register %s\n", init.name);
>         goto err_clk;
> }
> 
> init.name is freed and then used.
> 
> So reorder the free.
> 
> Fixes: f491276a5168 ("clk: vc5: Allow Versaclock driver to support multiple 
> instances")
> 
> Signed-off-by: Tom Rix <[email protected]>
> ---

There's another patch on the mailing list for this.

Reply via email to