[PATCH] Fix small buglets in the sr driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



James:

I found some small errors in the sr driver while working on something 
else (patch for that to follow).  In this patch (as571):

	Update the s_size variable when the block length is changed.
	This seems like such an obvious mistake, I have to wonder if
	I have misunderstood the code.

	Set SCpnt->underflow to the sector size instead of the transfer
	size.  If even one sector is transferred successfully, we
	should accept it and try to move forward -- don't decide that
	the whole thing failed.

Alan Stern



Signed-off-by: Alan Stern <stern@xxxxxxxxxxxxxxxxxxx>

Index: usb-2.6/drivers/scsi/sr.c
===================================================================
--- usb-2.6.orig/drivers/scsi/sr.c
+++ usb-2.6/drivers/scsi/sr.c
@@ -352,9 +352,10 @@ static int sr_init_command(struct scsi_c
 	 */
 	s_size = cd->device->sector_size;
 	if (s_size > 2048) {
-		if (!in_interrupt())
+		if (!in_interrupt()) {
 			sr_set_blocklength(cd, 2048);
-		else
+			s_size = 2048;
+		} else
 			printk("sr: can't switch blocksize: in interrupt\n");
 	}
 
@@ -431,8 +432,7 @@ static int sr_init_command(struct scsi_c
 	 * host adapter, it's safe to assume that we can at least transfer
 	 * this many bytes between each connect / disconnect.
 	 */
-	SCpnt->transfersize = cd->device->sector_size;
-	SCpnt->underflow = this_count << 9;
+	SCpnt->transfersize = SCpnt->underflow = s_size;
 
 queue:
 	SCpnt->allowed = MAX_RETRIES;

-
: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]
  Powered by Linux