Skip to content

Commit

Permalink
USB: EHCI: declare hostpc register as zero-length array
Browse files Browse the repository at this point in the history
The HOSTPC extension registers found in some EHCI implementations form
a variable-length array, with one element for each port.  Therefore
the hostpc field in struct ehci_regs should be declared as a
zero-length array, not a single-element array.

This fixes a problem reported by UBSAN.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Reported-by: Wilfried Klaebe <linux-kernel@lebenslange-mailadresse.de>
Tested-by: Wilfried Klaebe <linux-kernel@lebenslange-mailadresse.de>
CC: <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Alan Stern authored and Greg Kroah-Hartman committed Jun 25, 2016
1 parent 1a34c4d commit 7e8b3df
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions include/linux/usb/ehci_def.h
Original file line number Diff line number Diff line change
Expand Up @@ -180,11 +180,11 @@ struct ehci_regs {
* PORTSCx
*/
/* HOSTPC: offset 0x84 */
u32 hostpc[1]; /* HOSTPC extension */
u32 hostpc[0]; /* HOSTPC extension */
#define HOSTPC_PHCD (1<<22) /* Phy clock disable */
#define HOSTPC_PSPD (3<<25) /* Port speed detection */

u32 reserved5[16];
u32 reserved5[17];

/* USBMODE_EX: offset 0xc8 */
u32 usbmode_ex; /* USB Device mode extension */
Expand Down

0 comments on commit 7e8b3df

Please sign in to comment.