Re: USB: EHCI: declare hostpc register as zero-length array

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Greg:

Sorry, the Subject line of the original email left out "[PATCH]" at the 
beginning.  Will it still work with your scripts?

Alan Stern


On Thu, 23 Jun 2016, Alan Stern wrote:

> 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@xxxxxxxxxxxxxxxxxxx>
> Reported-by: Wilfried Klaebe <linux-kernel@xxxxxxxxxxxxxxxxxxxxxxxxxx>
> Tested-by: Wilfried Klaebe <linux-kernel@xxxxxxxxxxxxxxxxxxxxxxxxxx>
> CC: <stable@xxxxxxxxxxxxxxx>
> 
> ---
> 
> 
> [as1803]
> 
> 
>  include/linux/usb/ehci_def.h |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> Index: usb-4.x/include/linux/usb/ehci_def.h
> ===================================================================
> --- usb-4.x.orig/include/linux/usb/ehci_def.h
> +++ usb-4.x/include/linux/usb/ehci_def.h
> @@ -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 */

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux