aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/misc/usbtest.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2016-05-21 00:12:25 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2016-05-21 00:12:25 -0400
commit19e36ad292ab24980db64a5ff17973d3118a8fb9 (patch)
tree175715409a689814e5cd425a98f2d2d47f82addf /drivers/usb/misc/usbtest.c
parente10abc629f38efd9b6936cf3612583cc846104d9 (diff)
parent60d5794fe5a50d02f4a0df84b45910a4dfa8b487 (diff)
Merge tag 'usb-4.7-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb
Pull USB updates from Greg KH: "Here's the big pull request for USB and PHY drivers for 4.7-rc1 Full details in the shortlog, but it's the normal major gadget driver updates, phy updates, new usbip code, as well as a bit of lots of other stuff. All have been in linux-next with no reported issues" * tag 'usb-4.7-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb: (164 commits) USB: serial: ti_usb_3410_5052: add MOXA UPORT 11x0 support USB: serial: fix minor-number allocation USB: serial: quatech2: fix use-after-free in probe error path USB: serial: mxuport: fix use-after-free in probe error path USB: serial: keyspan: fix debug and error messages USB: serial: keyspan: fix URB unlink USB: serial: keyspan: fix use-after-free in probe error path USB: serial: io_edgeport: fix memory leaks in probe error path USB: serial: io_edgeport: fix memory leaks in attach error path usb: Remove unnecessary space before operator ','. usb: Remove unnecessary space before open square bracket. USB: FHCI: avoid redundant condition usb: host: xhci-rcar: Avoid long wait in xhci_reset() usb/host/fotg210: remove dead code in create_sysfs_files usb: wusbcore: Do not initialise statics to 0. usb: wusbcore: Remove space before ',' and '(' . USB: serial: cp210x: clean up CRTSCTS flag code USB: serial: cp210x: get rid of magic numbers in CRTSCTS flag code USB: serial: cp210x: fix hardware flow-control disable USB: serial: option: add even more ZTE device ids ...
Diffstat (limited to 'drivers/usb/misc/usbtest.c')
-rw-r--r--drivers/usb/misc/usbtest.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/usb/misc/usbtest.c b/drivers/usb/misc/usbtest.c
index 92fdb6e9faff..6b978f04b8d7 100644
--- a/drivers/usb/misc/usbtest.c
+++ b/drivers/usb/misc/usbtest.c
@@ -287,6 +287,9 @@ static struct urb *usbtest_alloc_urb(
287 if (usb_pipein(pipe)) 287 if (usb_pipein(pipe))
288 urb->transfer_flags |= URB_SHORT_NOT_OK; 288 urb->transfer_flags |= URB_SHORT_NOT_OK;
289 289
290 if ((bytes + offset) == 0)
291 return urb;
292
290 if (urb->transfer_flags & URB_NO_TRANSFER_DMA_MAP) 293 if (urb->transfer_flags & URB_NO_TRANSFER_DMA_MAP)
291 urb->transfer_buffer = usb_alloc_coherent(udev, bytes + offset, 294 urb->transfer_buffer = usb_alloc_coherent(udev, bytes + offset,
292 GFP_KERNEL, &urb->transfer_dma); 295 GFP_KERNEL, &urb->transfer_dma);
@@ -529,6 +532,7 @@ static struct scatterlist *
529alloc_sglist(int nents, int max, int vary, struct usbtest_dev *dev, int pipe) 532alloc_sglist(int nents, int max, int vary, struct usbtest_dev *dev, int pipe)
530{ 533{
531 struct scatterlist *sg; 534 struct scatterlist *sg;
535 unsigned int n_size = 0;
532 unsigned i; 536 unsigned i;
533 unsigned size = max; 537 unsigned size = max;
534 unsigned maxpacket = 538 unsigned maxpacket =
@@ -561,7 +565,8 @@ alloc_sglist(int nents, int max, int vary, struct usbtest_dev *dev, int pipe)
561 break; 565 break;
562 case 1: 566 case 1:
563 for (j = 0; j < size; j++) 567 for (j = 0; j < size; j++)
564 *buf++ = (u8) ((j % maxpacket) % 63); 568 *buf++ = (u8) (((j + n_size) % maxpacket) % 63);
569 n_size += size;
565 break; 570 break;
566 } 571 }
567 572