Skip to contentSkip to conversation

USB: fix create_pipe()

PATCH New Sergei Shtylyov 2 participants 2 messages May 26, 2010 – May 27, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 USB: fix create_pipe()

create_pipe() can give wrong result if an expression is passed as the 'endpoint' argument -- due to missing parentheses.

Thanks to Martin Mueller for finding the bug and providing the patch.

---
 include/usb.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/usb.h +1 -1
Index: u-boot/include/usb.h
===================================================================
@@ -259,7 +259,7 @@ int usb_set_interface(struct usb_device 
  */
 /* Create various pipes... */
 #define create_pipe(dev,endpoint) \
-		(((dev)->devnum << 8) | (endpoint << 15) | \
+		(((dev)->devnum << 8) | ((endpoint) << 15) | \
 		((dev)->speed << 26) | (dev)->maxpacketsize)
 #define default_pipe(dev) ((dev)->speed << 26)
 
#1 lore raw

PATCH 1/1 USB: fix create_pipe()

Hi,

2010/5/26 Sergei Shtylyov <[email protected]>:

Quoted 10 lines

create_pipe() can give wrong result if an expression is passed as the 'endpoint' argument -- due to missing parentheses.

Thanks to Martin Mueller for finding the bug and providing the patch.

---
?include/usb.h | ? ?2 +-
?1 file changed, 1 insertion(+), 1 deletion(-)

Applied to u-boot-usb
Thanks.

Remy