lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAKwvOdnj7rNeh0YeX2NPcbkoJBnRwXb9Dt0SF9mHaMKYVLjCjw@mail.gmail.com>
Date:   Tue, 18 Apr 2023 11:44:28 -0700
From:   Nick Desaulniers <ndesaulniers@...gle.com>
To:     Simon Horman <horms@...nel.org>
Cc:     Nishanth Menon <nm@...com>,
        Santosh Shilimkar <ssantosh@...nel.org>,
        Nathan Chancellor <nathan@...nel.org>,
        Tom Rix <trix@...hat.com>, linux-kernel@...r.kernel.org,
        linux-arm-kernel@...ts.infradead.org, llvm@...ts.linux.dev
Subject: Re: [PATCH] soc: ti: pruss: Avoid cast to incompatible function type

On Tue, Apr 18, 2023 at 4:41 AM Simon Horman <horms@...nel.org> wrote:
>
> Rather than casting clk_unregister_mux to an incompatible function
> type provide a trivial wrapper with the correct signature for the
> use-case.
>
> Reported by clang-16 with W=1:
>
>  drivers/soc/ti/pruss.c:158:38: error: cast from 'void (*)(struct clk *)' to 'void (*)(void *)' converts to incompatible function type [-Werror,-Wcast-function-type-strict]
>          ret = devm_add_action_or_reset(dev, (void(*)(void *))clk_unregister_mux,
>
> No functional change intended.
> Compile tested only.

Thanks for the patch!
Reviewed-by: Nick Desaulniers <ndesaulniers@...gle.com>

Here's some more suspects to look at, if you have cycles:
drivers/base/devres.c:734:int __devm_add_action(struct device *dev,
void (*action)(void *), void *data, const char *name)
drivers/i2c/busses/i2c-mchp-pci1xxxx.c:1159: ret =
devm_add_action(dev, (void (*)(void *))pci1xxxx_i2c_shutdown, i2c);
drivers/soc/ti/pruss.c:96: ret = devm_add_action_or_reset(dev,
(void(*)(void *))clk_unregister_mux,
drivers/mmc/host/meson-mx-sdhc-mmc.c:791: ret =
devm_add_action_or_reset(dev, (void(*)(void *))mmc_free_host,
drivers/pci/controller/pcie-microchip-host.c:866:
devm_add_action_or_reset(dev, (void (*) (void
*))clk_disable_unprepare,

>
> Signed-off-by: Simon Horman <horms@...nel.org>
> ---
>  drivers/soc/ti/pruss.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/soc/ti/pruss.c b/drivers/soc/ti/pruss.c
> index 6882c86b3ce5..e68441bd7b30 100644
> --- a/drivers/soc/ti/pruss.c
> +++ b/drivers/soc/ti/pruss.c
> @@ -38,6 +38,11 @@ static void pruss_of_free_clk_provider(void *data)
>         of_node_put(clk_mux_np);
>  }
>
> +static void pruss_clk_unregister_mux(void *data)
> +{
> +       clk_unregister_mux(data);
> +}
> +
>  static int pruss_clk_mux_setup(struct pruss *pruss, struct clk *clk_mux,
>                                char *mux_name, struct device_node *clks_np)
>  {
> @@ -93,8 +98,7 @@ static int pruss_clk_mux_setup(struct pruss *pruss, struct clk *clk_mux,
>                 goto put_clk_mux_np;
>         }
>
> -       ret = devm_add_action_or_reset(dev, (void(*)(void *))clk_unregister_mux,
> -                                      clk_mux);
> +       ret = devm_add_action_or_reset(dev, pruss_clk_unregister_mux, clk_mux);
>         if (ret) {
>                 dev_err(dev, "failed to add clkmux unregister action %d", ret);
>                 goto put_clk_mux_np;
>


-- 
Thanks,
~Nick Desaulniers

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ