Skip to content

Commit 7e8b3df

Browse files
AlanSterngregkh
authored andcommitted
USB: EHCI: declare hostpc register as zero-length array
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 <[email protected]> Reported-by: Wilfried Klaebe <[email protected]> Tested-by: Wilfried Klaebe <[email protected]> CC: <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 1a34c4d commit 7e8b3df

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

include/linux/usb/ehci_def.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,11 +180,11 @@ struct ehci_regs {
180180
* PORTSCx
181181
*/
182182
/* HOSTPC: offset 0x84 */
183-
u32 hostpc[1]; /* HOSTPC extension */
183+
u32 hostpc[0]; /* HOSTPC extension */
184184
#define HOSTPC_PHCD (1<<22) /* Phy clock disable */
185185
#define HOSTPC_PSPD (3<<25) /* Port speed detection */
186186

187-
u32 reserved5[16];
187+
u32 reserved5[17];
188188

189189
/* USBMODE_EX: offset 0xc8 */
190190
u32 usbmode_ex; /* USB Device mode extension */

0 commit comments

Comments
 (0)