]> git.baikalelectronics.ru Git - kernel.git/commit
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)
commit6ba9db98872ff546497048f4b06401f75189ef67
tree74562c28bbdfbcb06a2da476230687ce3592a59c
parent64cd70efeb8cad0c38da21f6a027646c4197d9b3
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