]> err.no Git - linux-2.6/commitdiff
[SCSI] ps3rom: fix wrong resid calculation bug
authorFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Mon, 25 Feb 2008 13:23:45 +0000 (14:23 +0100)
committerJames Bottomley <James.Bottomley@HansenPartnership.com>
Mon, 3 Mar 2008 19:06:37 +0000 (13:06 -0600)
sg driver rounds up the length in struct scatterlist to be a multiple
of 512 in some conditions. So LLDs can't use the data length in a sg
list to calculate residual. Instead, the length in struct scsi_cmnd
should be used.

[Geert: the variable buflen already contains scsi_bufflen(cmd)]

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Signed-off-by: Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
drivers/scsi/ps3rom.c

index 0cd614a0fa73d98eb354aee000c1c4f1909de050..e052c8479d51afe42deccb01f8350e9d29e542b8 100644 (file)
@@ -124,7 +124,7 @@ static int fill_from_dev_buffer(struct scsi_cmnd *cmd, const void *buf)
                }
                req_len += sgpnt->length;
        }
-       scsi_set_resid(cmd, req_len - act_len);
+       scsi_set_resid(cmd, buflen - act_len);
        return 0;
 }