[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240329134917.579c3557@endymion.delvare>
Date: Fri, 29 Mar 2024 13:49:17 +0100
From: Jean Delvare <jdelvare@...e.de>
To: Arnd Bergmann <arnd@...nel.org>
Cc: linux-kbuild@...r.kernel.org, Masahiro Yamada <masahiroy@...nel.org>,
Nathan Chancellor <nathan@...nel.org>, Greg Kroah-Hartman <gregkh@...e.de>,
Nicolas Schier <nicolas@...sle.eu>, Arnd Bergmann <arnd@...db.de>, Nick
Desaulniers <ndesaulniers@...gle.com>, Bill Wendling <morbo@...gle.com>,
Justin Stitt <justinstitt@...gle.com>, linux-kernel@...r.kernel.org,
llvm@...ts.linux.dev
Subject: Re: [PATCH 05/12] firmware: dmi-id: add a release callback function
Hi Arnd,
On Tue, 26 Mar 2024 15:51:30 +0100, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@...db.de>
>
> dmi_class uses kfree() as the .release function, but that now causes
> a warning with clang-16 as it violates control flow integrity (KCFI)
> rules:
>
> drivers/firmware/dmi-id.c:174:17: error: cast from 'void (*)(const void *)' to 'void (*)(struct device *)' converts to incompatible function type [-Werror,-Wcast-function-type-strict]
> 174 | .dev_release = (void(*)(struct device *)) kfree,
>
> Add an explicit function to call kfree() instead.
>
> Fixes: 4f5c791a850e ("DMI-based module autoloading")
Not sure if this fixes tag is really warranted. As I understand it,
your change only removes a warning but there was no actual bug, right?
> Link: https://lore.kernel.org/lkml/20240213100238.456912-1-arnd@kernel.org/
> Signed-off-by: Arnd Bergmann <arnd@...db.de>
> ---
> I sent this before but got no comments for it
I indeed overlooked your initial submission, my bad.
> ---
> drivers/firmware/dmi-id.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/firmware/dmi-id.c b/drivers/firmware/dmi-id.c
> index 5f3a3e913d28..d19c78a78ae3 100644
> --- a/drivers/firmware/dmi-id.c
> +++ b/drivers/firmware/dmi-id.c
> @@ -169,9 +169,14 @@ static int dmi_dev_uevent(const struct device *dev, struct kobj_uevent_env *env)
> return 0;
> }
>
> +static void dmi_dev_release(struct device *dev)
> +{
> + kfree(dev);
> +}
> +
> static struct class dmi_class = {
> .name = "dmi",
> - .dev_release = (void(*)(struct device *)) kfree,
> + .dev_release = dmi_dev_release,
> .dev_uevent = dmi_dev_uevent,
> };
>
Looks good to me, thanks for doing that.
Signed-off-by: Jean Delvare <jdelvare@...e.de>
Will you get this upstream, or do you expect me to take it in my
dmi/for-next branch?
--
Jean Delvare
SUSE L3 Support
Powered by blists - more mailing lists