mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-01 22:54:01 +00:00
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: 93c473948c
("usb: gadget: add WebUSB landing page support")
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Tested-By: Jó Ágila Bitsch <jgilab@gmail.com>
Link: https://lore.kernel.org/r/20230313154522.52684-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
a37eb61b6e
commit
bbf860ed71
1 changed files with 3 additions and 4 deletions
|
@ -2079,10 +2079,9 @@ composite_setup(struct usb_gadget *gadget, const struct usb_ctrlrequest *ctrl)
|
|||
sizeof(url_descriptor->URL)
|
||||
- WEBUSB_URL_DESCRIPTOR_HEADER_LENGTH + landing_page_offset);
|
||||
|
||||
if (ctrl->wLength < WEBUSB_URL_DESCRIPTOR_HEADER_LENGTH
|
||||
+ landing_page_length)
|
||||
landing_page_length = ctrl->wLength
|
||||
- WEBUSB_URL_DESCRIPTOR_HEADER_LENGTH + landing_page_offset;
|
||||
if (w_length < WEBUSB_URL_DESCRIPTOR_HEADER_LENGTH + landing_page_length)
|
||||
landing_page_length = w_length
|
||||
- WEBUSB_URL_DESCRIPTOR_HEADER_LENGTH + landing_page_offset;
|
||||
|
||||
memcpy(url_descriptor->URL,
|
||||
cdev->landing_page + landing_page_offset,
|
||||
|
|
Loading…
Reference in a new issue