USB: Fix off-by-1 error in the scatter-gather library
authorAlan Stern <stern@rowland.harvard.edu>
Thu, 21 Jun 2007 20:26:46 +0000 (16:26 -0400)
committerGreg Kroah-Hartman <gregkh@suse.de>
Thu, 12 Jul 2007 23:34:39 +0000 (16:34 -0700)
commit8ccef0df54642f0f72f922d8aa57e8b290e31671
tree74562c28bbdfbcb06a2da476230687ce3592a59c
parentcfa59dab27d1b282886e7772a8f9548236883892
USB: Fix off-by-1 error in the scatter-gather library

The loop in usb_sg_wait() is structured in a way that makes it hard to
tell, when the loop exits, whether or not the last URB submission
succeeded.  This patch (as928) changes it from a "for" loop to a
"while" loop and keeps "i" always equal to the number of successful
submissions.  This fixes an off-by-one error which can show up when
the first URB submission fails.

The patch also removes a couple of lines that initialize fields which
don't need to be initialized.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/usb/core/message.c