Re: [PATCH 05/12] firmware: dmi-id: add a release callback function
From: Arnd Bergmann
Date: Thu Apr 04 2024 - 10:10:16 EST
On Fri, Mar 29, 2024, at 13:49, Jean Delvare wrote:
> On Tue, 26 Mar 2024 15:51:30 +0100, Arnd Bergmann wrote:
>> From: Arnd Bergmann <arnd@xxxxxxxx>
>>
>> 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?
As Nathan already commented, it's a real bug. I also add 'Fixes'
tags for false-positives just to document what introduced a
warning. The Fixes tag doesn't automatically mean something gets
backported, though the stable maintainers often end up backporting
warning fixes as well, and it helps identify which kernels
need it.
> Looks good to me, thanks for doing that.
>
> Signed-off-by: Jean Delvare <jdelvare@xxxxxxx>
>
> Will you get this upstream, or do you expect me to take it in my
> dmi/for-next branch?
It would help me if you can apply it to your tree directly.
Arnd