Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit cdc77c82 authored by Mathias Nyman's avatar Mathias Nyman Committed by Greg Kroah-Hartman
Browse files

usb: misc: usbtest: fix pattern tests for scatterlists.



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: default avatarMathias Nyman <mathias.nyman@linux.intel.com>
Fixes: 8b524901 ("[PATCH] USB: usbtest: scatterlist OUT data pattern testing")
Cc: <stable@vger.kernel.org> # v2.6.18+
Acked-by: default avatarFelipe Balbi <felipe.balbi@linux.intel.com>
Acked-by: default avatarAlan Stern <stern@rowland.harvard.edu>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 72f595f3
Loading
Loading
Loading
Loading
+3 −1
Original line number Original line Diff line number Diff line
@@ -532,6 +532,7 @@ static struct scatterlist *
alloc_sglist(int nents, int max, int vary, struct usbtest_dev *dev, int pipe)
alloc_sglist(int nents, int max, int vary, struct usbtest_dev *dev, int pipe)
{
{
	struct scatterlist	*sg;
	struct scatterlist	*sg;
	unsigned int		n_size = 0;
	unsigned		i;
	unsigned		i;
	unsigned		size = max;
	unsigned		size = max;
	unsigned		maxpacket =
	unsigned		maxpacket =
@@ -564,7 +565,8 @@ alloc_sglist(int nents, int max, int vary, struct usbtest_dev *dev, int pipe)
			break;
			break;
		case 1:
		case 1:
			for (j = 0; j < size; j++)
			for (j = 0; j < size; j++)
				*buf++ = (u8) ((j % maxpacket) % 63);
				*buf++ = (u8) (((j + n_size) % maxpacket) % 63);
			n_size += size;
			break;
			break;
		}
		}