-
Alan Stern authored
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.
133d35e0