Skip to content
  • Alan Stern's avatar
    USB: Fix off-by-1 error in the scatter-gather library · 8ccef0df
    Alan Stern authored
    
    
    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: default avatarAlan Stern <stern@rowland.harvard.edu>
    Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
    8ccef0df