Skip to contentSkip to conversation

media: rc: igorplugusb: Fix wrong pointer passed to usb_fill_control_urb()

PATCH In review Moksh Panicker 2 participants 2 messages Jun 16 – Jun 17

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 media: rc: igorplugusb: Fix wrong pointer passed to usb_fill_control_urb()

ir->request is already a pointer to struct usb_ctrlrequest, so passing &ir->request passes the address of the pointer rather than the pointer itself. This causes usb_submit_urb() to read garbage as the URB setup packet, resulting in a direction mismatch warning:

usb 1-1: BOGUS control dir, pipe doesn't match bRequestType

Fix this by passing ir->request directly instead of &ir->request.

---
 drivers/media/rc/igorplugusb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/rc/igorplugusb.c +1 -1
index 3e10f6fe8..b5117ee9f 100644
@@ -184,7 +184,7 @@ static int igorplugusb_probe(struct usb_interface *intf,
 	if (!ir->buf_in)
 		goto fail;
 	usb_fill_control_urb(ir->urb, udev,
-		usb_rcvctrlpipe(udev, 0), (uint8_t *)&ir->request,
+		usb_rcvctrlpipe(udev, 0), (uint8_t *)ir->request,
 		ir->buf_in, MAX_PACKET, igorplugusb_callback, ir);
 
 	usb_make_path(udev, ir->phys, sizeof(ir->phys));
Signature · 1 line
2.34.1
maintainer
#1 lore raw
Quoted 8 lines · Moksh Panicker

ir->request is already a pointer to struct usb_ctrlrequest, so passing &ir->request passes the address of the pointer rather than the pointer itself. This causes usb_submit_urb() to read garbage as the URB setup packet, resulting in a direction mismatch warning:

usb 1-1: BOGUS control dir, pipe doesn't match bRequestType

Fix this by passing ir->request directly instead of &ir->request.

Already fixed and merged upstream, see commit
171022c7d594c133a45f92357a2a91475edabe20.

Thanks,

Sean

Quoted 24 lines
---
 drivers/media/rc/igorplugusb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/rc/igorplugusb.c +1 -1
index 3e10f6fe8..b5117ee9f 100644
@@ -184,7 +184,7 @@ static int igorplugusb_probe(struct usb_interface *intf,
 	if (!ir->buf_in)
 		goto fail;
 	usb_fill_control_urb(ir->urb, udev,
-		usb_rcvctrlpipe(udev, 0), (uint8_t *)&ir->request,
+		usb_rcvctrlpipe(udev, 0), (uint8_t *)ir->request,
 		ir->buf_in, MAX_PACKET, igorplugusb_callback, ir);
 
 	usb_make_path(udev, ir->phys, sizeof(ir->phys));
Signature · 1 line
2.34.1