Skip to contentSkip to conversation

usb: gadget: f_thor: Allocate request up to THOR_PACKET_SIZE

PATCH RESEND Superseded Michal Simek 3 participants 5 messages Apr 15, 2015 – Aug 12, 2015 USB

lore
Share & tools
lore
#0 lore raw

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

From: Siva Durga Prasad Paladugu <[email protected]>

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 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/gadget/f_thor.c +1 -1
index 31eec36be876..5c8f6768519c 100644
@@ -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;
Signature · 1 line
2.3.5
#1 lore raw

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

Hi Michal,

Quoted 19 lines

From: Siva Durga Prasad Paladugu <[email protected]>

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 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/gadget/f_thor.c +0 -0
index 31eec36be876..5c8f6768519c 100644

drivers/usb/gadget/f_thor.c static int thor_func_bind(struct · line 781

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

Signature · 5 lines
Best regards,

Lukasz Majewski

Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
#2 lore raw

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

Hi Lukasz,

Quoted 16 lines · Lukasz Majewski

Hi Michal,

Quoted 14 lines

From: Siva Durga Prasad Paladugu <[email protected]>

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 file changed, 1 insertion(+), 1 deletion(-)
Quoted 16 lines

drivers/usb/gadget/f_thor.c static int thor_func_bind(struct · line 781

Quoted 13 lines
drivers/usb/gadget/f_thor.c +1 -1
index 31eec36be876..5c8f6768519c 100644
@@ -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!

I can't see this patch in your branch. Did you add it?

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/20150812/a5a79340/attachment.sig>
#3 lore raw

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

Hi Michal,

Quoted 36 lines

Hi Lukasz,

Quoted 16 lines · Lukasz Majewski

Hi Michal,

Quoted 14 lines

From: Siva Durga Prasad Paladugu <[email protected]>

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 file changed, 1 insertion(+), 1 deletion(-)
Quoted 16 lines

drivers/usb/gadget/f_thor.c static int thor_func_bind(struct · line 781

Quoted 13 lines
(quoted diff) +0 -0

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

drivers/usb/gadget/f_thor.c +1 -1
@@ -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!

Quoted 1 line

I can't see this patch in your branch. Did you add it?

Please look into u-boot-dfu/testing branch.

I've placed them there for testing. Afterwards I will put them to master branch

Quoted 4 lines

Thanks,
Michal

Signature · 5 lines
Best regards,

Lukasz Majewski

Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
#4 lore raw

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

Quoted 38 lines · Lukasz Majewski

Hi Michal,

Quoted 36 lines

Hi Lukasz,

Quoted 32 lines · Lukasz Majewski

Hi Michal,

Quoted 19 lines

From: Siva Durga Prasad Paladugu <[email protected]>

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 file changed, 1 insertion(+), 1 deletion(-)
(quoted diff) +0 -0

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

drivers/usb/gadget/f_thor.c static int thor_func_bind(struct · line 781

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

Quoted 6 lines
Quoted 1 line

I can't see this patch in your branch. Did you add it?

Please look into u-boot-dfu/testing branch.

I've placed them there for testing. Afterwards I will put them to master branch

Ok.

Thanks,
Michal