Skip to content

Commit

Permalink
USB: fix bug in sg initialization in usbtest
Browse files Browse the repository at this point in the history
This patch (as1062) fixes a bug in the scatter-gather initialization
code in the usbtest driver.  When the sg-helper conversion was
performed, it wasn't done correctly.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
CC: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
Alan Stern authored and Greg Kroah-Hartman committed Apr 2, 2008
1 parent d04863e commit 4756feb
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/usb/misc/usbtest.c
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,7 @@ alloc_sglist (int nents, int max, int vary)
sg = kmalloc (nents * sizeof *sg, GFP_KERNEL);
if (!sg)
return NULL;
sg_init_table(sg, nents);

for (i = 0; i < nents; i++) {
char *buf;
Expand All @@ -390,7 +391,7 @@ alloc_sglist (int nents, int max, int vary)
}

/* kmalloc pages are always physically contiguous! */
sg_init_one(&sg[i], buf, size);
sg_set_buf(&sg[i], buf, size);

switch (pattern) {
case 0:
Expand Down

0 comments on commit 4756feb

Please sign in to comment.