]> git.hungrycats.org Git - linux/commit
[PATCH] PATCH: (as70b) Update request_bufflen to match this_count
authorAlan Stern <stern@rowland.harvard.edu>
Sat, 16 Aug 2003 06:28:53 +0000 (01:28 -0500)
committerJames Bottomley <jejb@fuzzy.(none)>
Sat, 16 Aug 2003 06:28:53 +0000 (01:28 -0500)
commit133d35e013f48746f47aeaa5b958025d81033a73
treece39d7251c79a2917430e0b48826a0a15dc7218c
parent350e26aaf9598820f0cca9e238a418fe04c32aff
[PATCH] PATCH: (as70b) Update request_bufflen to match this_count

This patch addresses a problem in both sd.c and sr.c.  When a read/write
command is initialized, the routines may reduce this_count (the number of
sectors to transfer) if it exceeds the maximum allowed value (i.e., 0xffff
for READ(10)).  However, the code does not similarly alter
scmd->request_bufflen and scmd->bufflen to match the change in the CDB
value.

scmd->request_bufflen is important for the usb-storage driver, which
requires that it be exactly equal to the number of bytes transferred.
scmd->bufflen is used in the rw_intr() routines, where it is passed to
scsi_io_completion() as the number of sectors transferred if no errors
occur.

Another small change in the patch concerns the code in sr.c that checks
whether the total of the scatter-gather area lengths matches
scmd->request_bufflen.  If they don't match, the patch bumps the kernel
log message level up to KERN_ERR, and it takes the more conservative
approach of adjusting scmd->request_bufflen only if the s-g length is
smaller than the request length.
drivers/scsi/sd.c
drivers/scsi/sr.c