Skip to contentSkip to conversation

usb: gadget: f_thor: Allocate request up to THOR_PACKET_SIZE

PATCH New Siva Durga Prasad Paladugu 2 participants 3 messages Sep 5, 2014 – Apr 15, 2015 USB

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 usb: gadget: f_thor: Allocate request up to THOR_PACKET_SIZE

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.

---
 drivers/usb/gadget/f_thor.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/usb/gadget/f_thor.c +1 -1
index c85b0fb..98d2d8c 100644
@@ -766,7 +766,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;
Signature · 1 line
1.7.4
#1 lore raw

PATCH 1/1 usb: gadget: f_thor: Allocate request up to THOR_PACKET_SIZE

Quoted 16 lines · 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.

---
 drivers/usb/gadget/f_thor.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/usb/gadget/f_thor.c +0 -0
index c85b0fb..98d2d8c 100644

drivers/usb/gadget/f_thor.c static int thor_func_bind(struct usb_configuration *c, struct usb_function *f) · line 772

Quoted 8 lines
drivers/usb/gadget/f_thor.c +1 -1
@@ -766,7 +766,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;

Thanks,
Michal

Signature · 14 lines
Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel - Microblaze cpu - http://www.monstr.eu/fdt/
Maintainer of Linux kernel - Xilinx Zynq ARM architecture
Microblaze U-BOOT custodian and responsible for u-boot arm zynq platform


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140924/d8b3079a/attachment.pgp>
#2 lore raw

PATCH 1/1 usb: gadget: f_thor: Allocate request up to THOR_PACKET_SIZE

Hi Marek,

2014-09-24 14:28 GMT+02:00 Michal Simek <[email protected]>:

Quoted 27 lines · Siva Durga Prasad Paladugu

drivers/usb/gadget/f_thor.c static int thor_func_bind(struct usb_configuration

Quoted 15 lines

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.

---
 drivers/usb/gadget/f_thor.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/usb/gadget/f_thor.c +0 -0
index c85b0fb..98d2d8c 100644
@@ -766,7 +766,7 @@ static int thor_func_bind(struct usb_configuration

*c, struct usb_function *f)

drivers/usb/gadget/f_thor.c static int thor_func_bind(struct usb_configuration *c, struct usb_function *f) · line 772

Quoted 9 lines
drivers/usb/gadget/f_thor.c +1 -1
              goto fail;
      }
      dev->req->buf = memalign(CONFIG_SYS_CACHELINE_SIZE,
-                              gadget->ep0->maxpacket);
+                              THOR_PACKET_SIZE);
      if (!dev->req->buf) {
              status = -ENOMEM;
              goto fail;
Quoted 6 lines

Thanks,
Michal

Any update on this one?

Thanks,
Michal

Signature · 5 lines
Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel - Microblaze cpu - http://www.monstr.eu/fdt/
Maintainer of Linux kernel - Xilinx Zynq ARM architecture
Microblaze U-BOOT custodian and responsible for u-boot arm zynq platform