diff mbox

[3/7] 3w-9xxx: fix transfer length 0 for 6-byte r/w commands

Message ID 1431760673-7180-4-git-send-email-akinobu.mita@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Akinobu Mita May 16, 2015, 7:17 a.m. UTC
For 6-byte r/w commands, transfer length 0 means 256 blocks of data,
not 0 block.

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: Adam Radford <linuxraid@lsi.com>
Cc: linux-scsi@vger.kernel.org
---
 drivers/scsi/3w-9xxx.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
diff mbox

Patch

diff --git a/drivers/scsi/3w-9xxx.c b/drivers/scsi/3w-9xxx.c
index add419d..71ddb7f 100644
--- a/drivers/scsi/3w-9xxx.c
+++ b/drivers/scsi/3w-9xxx.c
@@ -1870,8 +1870,11 @@  static int twa_scsiop_execute_scsi(TW_Device_Extension *tw_dev, int request_id,
 	}
 
 	if (srb) {
-		if (srb->cmnd[0] == READ_6 || srb->cmnd[0] == WRITE_6)
+		if (srb->cmnd[0] == READ_6 || srb->cmnd[0] == WRITE_6) {
 			num_sectors = (u32)srb->cmnd[4];
+			if (num_sectors == 0)
+				num_sectors = 256;
+		}
 
 		if (srb->cmnd[0] == READ_10 || srb->cmnd[0] == WRITE_10)
 			num_sectors = (u32)srb->cmnd[8] | ((u32)srb->cmnd[7] << 8);