From mboxrd@z Thu Jan 1 00:00:00 1970 From: Lukasz Majewski Date: Fri, 24 Apr 2015 17:46:44 +0200 Subject: [U-Boot] [RESEND PATCH] usb: gadget: f_thor: Allocate request up to THOR_PACKET_SIZE In-Reply-To: <0cdbb683a15f4c5d3989aa1758c887f1603c83df.1429098137.git.michal.simek@xilinx.com> References: <0cdbb683a15f4c5d3989aa1758c887f1603c83df.1429098137.git.michal.simek@xilinx.com> Message-ID: <20150424174644.784bdc1c@amdc2363> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Hi Michal, > From: Siva Durga Prasad Paladugu > > Allocate request up to THOR_PACKET_SIZE not the ep0->maxpacket > as the descriptors data depend on the number of descriptors > and this 64 bytes were not enough and the buffer might overflow > which results in memalign failures later. > > Signed-off-by: Siva Durga Prasad Paladugu > Signed-off-by: Michal Simek > --- > > drivers/usb/gadget/f_thor.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/usb/gadget/f_thor.c b/drivers/usb/gadget/f_thor.c > index 31eec36be876..5c8f6768519c 100644 > --- a/drivers/usb/gadget/f_thor.c > +++ b/drivers/usb/gadget/f_thor.c > @@ -775,7 +775,7 @@ static int thor_func_bind(struct > usb_configuration *c, struct usb_function *f) goto fail; > } > dev->req->buf = memalign(CONFIG_SYS_CACHELINE_SIZE, > - gadget->ep0->maxpacket); > + THOR_PACKET_SIZE); > if (!dev->req->buf) { > status = -ENOMEM; > goto fail; Applied to u-boot-dfu. Thanks! -- Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group