1
linux/drivers/firmware/arm_ffa
Gavin Shan b079883841 firmware: arm_ffa: Avoid string-fortify warning caused by memcpy()
Copying from a 144 byte structure arm_smccc_1_2_regs at an offset of 32
into an 112 byte struct ffa_send_direct_data2 causes a compile-time warning:

 | In file included from drivers/firmware/arm_ffa/driver.c:25:
 | In function 'fortify_memcpy_chk',
 |    inlined from 'ffa_msg_send_direct_req2' at drivers/firmware/arm_ffa/driver.c:504:3:
 | include/linux/fortify-string.h:580:4: warning: call to '__read_overflow2_field'
 | 	declared with 'warning' attribute: detected read beyond size of field
 | 	(2nd parameter); maybe use struct_group()? [-Wattribute-warning]
 |                         __read_overflow2_field(q_size_field, size);

Fix it by not passing a plain buffer to memcpy() to avoid the overflow
warning.

Fixes: aaef3bc981 ("firmware: arm_ffa: Add support for FFA_MSG_SEND_DIRECT_{REQ,RESP}2")
Signed-off-by: Gavin Shan <gshan@redhat.com>
Message-Id: <20241014004724.991353-1-gshan@redhat.com>
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
2024-10-15 13:50:10 +01:00
..
bus.c Driver core changes for 6.11-rc1 2024-07-25 10:42:22 -07:00
common.h firmware: arm_ffa: Split bus and driver into distinct modules 2024-05-29 23:23:25 +01:00
driver.c firmware: arm_ffa: Avoid string-fortify warning caused by memcpy() 2024-10-15 13:50:10 +01:00
Kconfig
Makefile firmware: arm_ffa: Split bus and driver into distinct modules 2024-05-29 23:23:25 +01:00
smccc.c