Skip to content

Commit

Permalink
[SCSI] ps3rom: fix wrong resid calculation bug
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
FUJITA Tomonori authored and James Bottomley committed Mar 3, 2008
1 parent 00da714 commit 67768f6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/scsi/ps3rom.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit 67768f6

Please sign in to comment.