Skip to content

Commit bbf860e

Browse files
andy-shevgregkh
authored andcommitted
usb: gadget: Use correct endianness of the wLength field for WebUSB
WebUSB code uses wLength directly without proper endianness conversion. Update it to use already prepared temporary variable w_length instead. Fixes: 93c4739 ("usb: gadget: add WebUSB landing page support") Signed-off-by: Andy Shevchenko <[email protected]> Tested-By: Jó Ágila Bitsch <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent a37eb61 commit bbf860e

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

drivers/usb/gadget/composite.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2079,10 +2079,9 @@ composite_setup(struct usb_gadget *gadget, const struct usb_ctrlrequest *ctrl)
20792079
sizeof(url_descriptor->URL)
20802080
- WEBUSB_URL_DESCRIPTOR_HEADER_LENGTH + landing_page_offset);
20812081

2082-
if (ctrl->wLength < WEBUSB_URL_DESCRIPTOR_HEADER_LENGTH
2083-
+ landing_page_length)
2084-
landing_page_length = ctrl->wLength
2085-
- WEBUSB_URL_DESCRIPTOR_HEADER_LENGTH + landing_page_offset;
2082+
if (w_length < WEBUSB_URL_DESCRIPTOR_HEADER_LENGTH + landing_page_length)
2083+
landing_page_length = w_length
2084+
- WEBUSB_URL_DESCRIPTOR_HEADER_LENGTH + landing_page_offset;
20862085

20872086
memcpy(url_descriptor->URL,
20882087
cdev->landing_page + landing_page_offset,

0 commit comments

Comments
 (0)