Re: [PATCH] firmware: arm_ffa: avoid string-fortify warningn in export_uuid()

From: Sudeep Holla
Date: Wed Sep 11 2024 - 10:15:06 EST


On Mon, Sep 09, 2024 at 11:09:24AM +0000, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@xxxxxxxx>
>
> Copying to a 16 byte structure into an 8-byte struct member
> causes a compile-time warning:
>
> In file included from drivers/firmware/arm_ffa/driver.c:25:
> In function 'fortify_memcpy_chk',
> inlined from 'export_uuid' at include/linux/uuid.h:88:2,
> inlined from 'ffa_msg_send_direct_req2' at drivers/firmware/arm_ffa/driver.c:488:2:
> include/linux/fortify-string.h:571:25: error: call to '__write_overflow_field' declared with attribute warning: detected write beyond size of field (1st parameter); maybe use struct_group()? [-Werror=attribute-warning]
> 571 | __write_overflow_field(p_size_field, size);
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> Use a union for the conversion instead and make sure the byte order
> is fixed in the process.
>

Thanks for spotting and fixing the issue. I tested enabling
CONFIG_FORTIFY_SOURCE but couldn't hit this with gcc 13 and clang 20

Also do you want this sent as fix on top of my FF-A PR now or after -rc1 ?

--
Regards,
Sudeep