mirror_ubuntu-kernels/include/uapi/linux/usb
Dmitry Antipov 61fbf20312 usb: gadget: f_fs: fix fortify warning
When compiling with gcc version 14.0.0 20231206 (experimental)
and CONFIG_FORTIFY_SOURCE=y, I've noticed the following warning:

...
In function 'fortify_memcpy_chk',
    inlined from '__ffs_func_bind_do_os_desc' at drivers/usb/gadget/function/f_fs.c:2934:3:
./include/linux/fortify-string.h:588:25: warning: call to '__read_overflow2_field'
declared with attribute warning: detected read beyond size of field (2nd parameter);
maybe use struct_group()? [-Wattribute-warning]
  588 |                         __read_overflow2_field(q_size_field, size);
      |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

This call to 'memcpy()' is interpreted as an attempt to copy both
'CompatibleID' and 'SubCompatibleID' of 'struct usb_ext_compat_desc'
from an address of the first one, which causes an overread warning.
Since we actually want to copy both of them at once, use the
convenient 'struct_group()' and 'sizeof_field()' here.

Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru>
Link: https://lore.kernel.org/r/20231214090428.27292-1-dmantipov@yandex.ru
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-12-15 13:55:45 +01:00
..
audio.h treewide: uapi: Replace zero-length arrays with flexible-array members 2022-06-28 21:26:05 +02:00
cdc-wdm.h License cleanup: add SPDX license identifier to uapi header files with a license 2017-11-02 11:20:11 +01:00
cdc.h USB / Thunderbolt changes for 6.0-rc1 2022-08-04 11:41:28 -07:00
ch9.h USB: Remove remnants of Wireless USB and UWB 2023-08-09 14:17:06 +02:00
ch11.h USB: Remove remnants of Wireless USB and UWB 2023-08-09 14:17:06 +02:00
charger.h usb: charger: assign specific number for enum value 2020-02-10 11:08:30 -08:00
functionfs.h usb: gadget: f_fs: fix fortify warning 2023-12-15 13:55:45 +01:00
g_printer.h License cleanup: add SPDX license identifier to uapi header files with a license 2017-11-02 11:20:11 +01:00
g_uvc.h usb: gadget: uvc: default the ctrl request interface offsets 2022-10-22 13:22:40 +02:00
gadgetfs.h License cleanup: add SPDX license identifier to uapi header files with no license 2017-11-02 11:19:54 +01:00
midi.h License cleanup: add SPDX license identifier to uapi header files with a license 2017-11-02 11:20:11 +01:00
raw_gadget.h usb: raw-gadget: report suspend, resume, reset, and disconnect events 2023-10-27 12:58:16 +02:00
tmc.h USB: usbtmc: Add separate USBTMC_IOCTL_GET_SRQ_STB 2020-12-28 15:50:30 +01:00
video.h usb: uvc: Enumerate valid values for color matching 2023-02-06 13:46:42 +01:00