Rework FS#12310 fix (r30906) for better readability. No functional change.

git-svn-id: svn://svn.rockbox.org/rockbox/branches/v3_10@30954 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Michael Sparmann 2011-11-10 10:37:05 +00:00
parent 8735bb0afc
commit 247cb149dd

View file

@ -48,10 +48,18 @@ struct ep_type
} ; } ;
static struct ep_type endpoints[USB_NUM_ENDPOINTS]; static struct ep_type endpoints[USB_NUM_ENDPOINTS];
static union
/* USB control requests may be up to 64 bytes in size.
Even though we never use anything more than the 8 header bytes,
we are required to accept request packets of up to 64 bytes size.
Provide buffer space for these additional payload bytes so that
e.g. write descriptor requests (which are rejected by us, but the
payload is transferred anyway) do not cause memory corruption.
Fixes FS#12310. -- Michael Sparmann (theseven) */
static struct
{ {
unsigned char data[64]; struct usb_ctrlrequest header; /* 8 bytes */
struct usb_ctrlrequest req; unsigned char payload[64 - sizeof(struct usb_ctrlrequest)];
} ctrlreq USB_DEVBSS_ATTR; } ctrlreq USB_DEVBSS_ATTR;
int usb_drv_port_speed(void) int usb_drv_port_speed(void)