Commit 09b69dd4 authored by Kees Cook's avatar Kees Cook Committed by Greg Kroah-Hartman

usb: ch9: Replace 1-element array with flexible array

Since commit df8fc4e9 ("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.
Reported-by: default avatarkernel test robot <oliver.sang@intel.com>
Closes: https://lore.kernel.org/oe-lkp/202306102333.8f5a7443-oliver.sang@intel.com
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: kernel test robot <lkp@intel.com>
Cc: "Gustavo A. R. Silva" <gustavoars@kernel.org>
Cc: Dan Williams <dan.j.williams@intel.com>
Cc: "Jó Ágila Bitsch" <jgilab@gmail.com>
Signed-off-by: default avatarKees Cook <keescook@chromium.org>
Message-ID: <20230614181307.gonna.256-kees@kernel.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent df49f2a0
...@@ -376,7 +376,10 @@ struct usb_string_descriptor { ...@@ -376,7 +376,10 @@ struct usb_string_descriptor {
__u8 bLength; __u8 bLength;
__u8 bDescriptorType; __u8 bDescriptorType;
__le16 wData[1]; /* UTF-16LE encoded */ union {
__le16 legacy_padding;
__DECLARE_FLEX_ARRAY(__le16, wData); /* UTF-16LE encoded */
};
} __attribute__ ((packed)); } __attribute__ ((packed));
/* note that "string" zero is special, it holds language codes that /* note that "string" zero is special, it holds language codes that
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment