]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
usb: misc: usbtest: fix pattern tests for scatterlists.
authorMathias Nyman <mathias.nyman@linux.intel.com>
Mon, 2 May 2016 08:39:03 +0000 (11:39 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 1 Jun 2016 19:17:00 +0000 (12:17 -0700)
commit cdc77c82a8286b1181b81b6e5ef60c8e83ded7bc upstream.

The current implemenentation restart the sent pattern for each entry in
the sg list. The receiving end expects a continuous pattern, and test
will fail unless scatterilst entries happen to be aligned with the
pattern

Fix this by calculating the pattern byte based on total sent size
instead of just the current sg entry.

Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Fixes: 8b5249019352 ("[PATCH] USB: usbtest: scatterlist OUT data pattern testing")
Acked-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/misc/usbtest.c

index 92fdb6e9faff4003a157ea742a2193e869d06519..c78ff95a43bec26bd1ee8d3700b47c66af2c8e18 100644 (file)
@@ -529,6 +529,7 @@ static struct scatterlist *
 alloc_sglist(int nents, int max, int vary, struct usbtest_dev *dev, int pipe)
 {
        struct scatterlist      *sg;
+       unsigned int            n_size = 0;
        unsigned                i;
        unsigned                size = max;
        unsigned                maxpacket =
@@ -561,7 +562,8 @@ alloc_sglist(int nents, int max, int vary, struct usbtest_dev *dev, int pipe)
                        break;
                case 1:
                        for (j = 0; j < size; j++)
-                               *buf++ = (u8) ((j % maxpacket) % 63);
+                               *buf++ = (u8) (((j + n_size) % maxpacket) % 63);
+                       n_size += size;
                        break;
                }