提交 fa4144b7 编写于 作者: A Al Viro 提交者: Linus Torvalds

cdc-wdm endianness fixes

* 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: NAl Viro <viro@zeniv.linux.org.uk>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 76e6f252
......@@ -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)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册