Since commit df8fc4e934c1 ("kbuild: Enable -fstrict-flex-arrays=3"), UBSAN_BOUNDS no longer pretends 1-element arrays are unbounded. Walking wData will trigger a warning, so make it a proper flexible array. Add a union to keep the struct size identical for userspace in case anything was depending on the old size.
Showing the changes to include/uapi (1 of 1 file). Show all
Unified · Split
| @@ -376,7 +376,10 @@ struct usb_string_descriptor { · 375 unmodified lines | ||
| 376 | 376 | __u8 bLength; |
| 377 | 377 | __u8 bDescriptorType; |
| 378 | 378 | |
| 379 | − __le16 wData[1]; /* UTF-16LE encoded */ | |
| 379 | + union { | |
| 380 | + __le16 legacy_padding; | |
| 381 | + __DECLARE_FLEX_ARRAY(__le16, wData); /* UTF-16LE encoded */ | |
| 382 | + }; | |
| 380 | 383 | } __attribute__ ((packed)); |
| 381 | 384 | |
| 382 | 385 | /* note that "string" zero is special, it holds language codes that |