From 6d512a80c26d87f8599057c86dc920fbfe0aa3aa Mon Sep 17 00:00:00 2001 From: Alan Stern Date: Fri, 22 Feb 2008 17:00:06 -0500 Subject: usb-storage: update earlier scatter-gather bug fix This patch (as1037) makes a small update to the earlier as1035 patch. The minimum-length computation shouldn't be done in usb_stor_access_xfer_buf(), since that routine can be called multiple times for a single transfer. It should be done in usb_stor_set_xfer_buf() instead, which gets called only once. The way it is now isn't really _wrong_, but it isn't really _right_ either. Moving the statement will be an improvement. Signed-off-by: Alan Stern Signed-off-by: Greg Kroah-Hartman --- drivers/usb/storage/protocol.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/usb') diff --git a/drivers/usb/storage/protocol.c b/drivers/usb/storage/protocol.c index 958f5b17847c..b9b8ede61fb3 100644 --- a/drivers/usb/storage/protocol.c +++ b/drivers/usb/storage/protocol.c @@ -170,7 +170,6 @@ unsigned int usb_stor_access_xfer_buf(unsigned char *buffer, if (!sg) sg = scsi_sglist(srb); - buflen = min(buflen, scsi_bufflen(srb)); /* This loop handles a single s-g list entry, which may * include multiple pages. Find the initial page structure @@ -232,6 +231,7 @@ void usb_stor_set_xfer_buf(unsigned char *buffer, unsigned int offset = 0; struct scatterlist *sg = NULL; + buflen = min(buflen, scsi_bufflen(srb)); buflen = usb_stor_access_xfer_buf(buffer, buflen, srb, &sg, &offset, TO_XFER_BUF); if (buflen < scsi_bufflen(srb)) -- cgit v1.2.3