Skip to content

Commit

Permalink
cdc-wdm endianness fixes
Browse files Browse the repository at this point in the history
* wMaxPacketSize is le16; copying it to a field of local structure and then
  using that field as host-endian (size of object to be allocated) is broken.
* bMaxPacketSize0 is 8-bit; feeding it to le16_to_cpu() is bogus and since the
  result is used as host-endian, it's not even misspelled cpu_to_le16().

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Al Viro authored and Linus Torvalds committed Jun 4, 2008
1 parent 76e6f25 commit fa4144b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/usb/class/cdc-wdm.c
Original file line number Diff line number Diff line change
Expand Up @@ -611,8 +611,8 @@ static int wdm_probe(struct usb_interface *intf, const struct usb_device_id *id)
goto err;
}

desc->wMaxPacketSize = ep->wMaxPacketSize;
desc->bMaxPacketSize0 = cpu_to_le16(udev->descriptor.bMaxPacketSize0);
desc->wMaxPacketSize = le16_to_cpu(ep->wMaxPacketSize);
desc->bMaxPacketSize0 = udev->descriptor.bMaxPacketSize0;

desc->orq = kmalloc(sizeof(struct usb_ctrlrequest), GFP_KERNEL);
if (!desc->orq)
Expand Down

0 comments on commit fa4144b

Please sign in to comment.