Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[SCSI] ps3rom: fix wrong resid calculation bug

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>

authored by

FUJITA Tomonori and committed by
James Bottomley
67768f67 00da714b

+1 -1
+1 -1
drivers/scsi/ps3rom.c
··· 124 124 } 125 125 req_len += sgpnt->length; 126 126 } 127 - scsi_set_resid(cmd, req_len - act_len); 127 + scsi_set_resid(cmd, buflen - act_len); 128 128 return 0; 129 129 } 130 130