aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/scsi_lib.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/scsi_lib.c')
-rw-r--r--drivers/scsi/scsi_lib.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index aa9fc572e45f..7d49ef589f33 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -240,11 +240,11 @@ int scsi_execute(struct scsi_device *sdev, const unsigned char *cmd,
240 * is invalid. Prevent the garbage from being misinterpreted 240 * is invalid. Prevent the garbage from being misinterpreted
241 * and prevent security leaks by zeroing out the excess data. 241 * and prevent security leaks by zeroing out the excess data.
242 */ 242 */
243 if (unlikely(req->data_len > 0 && req->data_len <= bufflen)) 243 if (unlikely(req->resid_len > 0 && req->resid_len <= bufflen))
244 memset(buffer + (bufflen - req->data_len), 0, req->data_len); 244 memset(buffer + (bufflen - req->resid_len), 0, req->resid_len);
245 245
246 if (resid) 246 if (resid)
247 *resid = req->data_len; 247 *resid = req->resid_len;
248 ret = req->errors; 248 ret = req->errors;
249 out: 249 out:
250 blk_put_request(req); 250 blk_put_request(req);
@@ -549,7 +549,7 @@ static struct scsi_cmnd *scsi_end_request(struct scsi_cmnd *cmd, int error,
549 int leftover = (req->hard_nr_sectors << 9); 549 int leftover = (req->hard_nr_sectors << 9);
550 550
551 if (blk_pc_request(req)) 551 if (blk_pc_request(req))
552 leftover = req->data_len; 552 leftover = req->resid_len;
553 553
554 /* kill remainder if no retrys */ 554 /* kill remainder if no retrys */
555 if (error && scsi_noretry_cmd(cmd)) 555 if (error && scsi_noretry_cmd(cmd))
@@ -673,11 +673,11 @@ void scsi_release_buffers(struct scsi_cmnd *cmd)
673EXPORT_SYMBOL(scsi_release_buffers); 673EXPORT_SYMBOL(scsi_release_buffers);
674 674
675/* 675/*
676 * Bidi commands Must be complete as a whole, both sides at once. 676 * Bidi commands Must be complete as a whole, both sides at once. If
677 * If part of the bytes were written and lld returned 677 * part of the bytes were written and lld returned scsi_in()->resid
678 * scsi_in()->resid and/or scsi_out()->resid this information will be left 678 * and/or scsi_out()->resid this information will be left in
679 * in req->data_len and req->next_rq->data_len. The upper-layer driver can 679 * req->resid_len and req->next_rq->resid_len. The upper-layer driver
680 * decide what to do with this information. 680 * can decide what to do with this information.
681 */ 681 */
682static void scsi_end_bidi_request(struct scsi_cmnd *cmd) 682static void scsi_end_bidi_request(struct scsi_cmnd *cmd)
683{ 683{
@@ -685,8 +685,8 @@ static void scsi_end_bidi_request(struct scsi_cmnd *cmd)
685 unsigned int dlen = req->data_len; 685 unsigned int dlen = req->data_len;
686 unsigned int next_dlen = req->next_rq->data_len; 686 unsigned int next_dlen = req->next_rq->data_len;
687 687
688 req->data_len = scsi_out(cmd)->resid; 688 req->resid_len = scsi_out(cmd)->resid;
689 req->next_rq->data_len = scsi_in(cmd)->resid; 689 req->next_rq->resid_len = scsi_in(cmd)->resid;
690 690
691 /* The req and req->next_rq have not been completed */ 691 /* The req and req->next_rq have not been completed */
692 BUG_ON(blk_end_bidi_request(req, 0, dlen, next_dlen)); 692 BUG_ON(blk_end_bidi_request(req, 0, dlen, next_dlen));
@@ -778,7 +778,7 @@ void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes)
778 scsi_end_bidi_request(cmd); 778 scsi_end_bidi_request(cmd);
779 return; 779 return;
780 } 780 }
781 req->data_len = scsi_get_resid(cmd); 781 req->resid_len = scsi_get_resid(cmd);
782 } 782 }
783 783
784 BUG_ON(blk_bidi_rq(req)); /* bidi not support for !blk_pc_request yet */ 784 BUG_ON(blk_bidi_rq(req)); /* bidi not support for !blk_pc_request yet */