ia64/linux-2.6.18-xen.hg

changeset 755:3669e92f24cd

[PVSCSI] Fix sense_len

Signed-off-by: James Harper <james.harper@bendigoit.com.au>
Signed-off-by: Tomonari Horikoshi <t.horikoshi@jp.fujitsu.com>
Signed-off-by: Jun Kamada <kama@jp.fujitsu.com>
author Keir Fraser <keir.fraser@citrix.com>
date Tue Dec 09 13:02:20 2008 +0000 (2008-12-09)
parents 82ce2e69bb5b
children eccc622d03af
files drivers/xen/scsiback/scsiback.c
line diff
     1.1 --- a/drivers/xen/scsiback/scsiback.c	Tue Dec 09 13:02:02 2008 +0000
     1.2 +++ b/drivers/xen/scsiback/scsiback.c	Tue Dec 09 13:02:20 2008 +0000
     1.3 @@ -148,6 +148,7 @@ void scsiback_do_resp_with_sense(char *s
     1.4  	struct vscsibk_info *info = pending_req->info;
     1.5  	int notify;
     1.6  	int more_to_do = 1;
     1.7 +	struct scsi_sense_hdr sshdr;
     1.8  	unsigned long flags;
     1.9  
    1.10  	DPRINTK("%s\n",__FUNCTION__);
    1.11 @@ -161,9 +162,17 @@ void scsiback_do_resp_with_sense(char *s
    1.12  	ring_res->rqid   = pending_req->rqid;
    1.13  
    1.14  	if (sense_buffer != NULL) {
    1.15 -		memcpy(ring_res->sense_buffer, sense_buffer,
    1.16 -				VSCSIIF_SENSE_BUFFERSIZE);
    1.17 -		ring_res->sense_len = VSCSIIF_SENSE_BUFFERSIZE;
    1.18 +		if (scsi_normalize_sense(sense_buffer,
    1.19 +			sizeof(sense_buffer), &sshdr)) {
    1.20 +
    1.21 +			int len = 8 + sense_buffer[7];
    1.22 +
    1.23 +			if (len > VSCSIIF_SENSE_BUFFERSIZE)
    1.24 +				len = VSCSIIF_SENSE_BUFFERSIZE;
    1.25 +
    1.26 +			memcpy(ring_res->sense_buffer, sense_buffer, len);
    1.27 +			ring_res->sense_len = len;
    1.28 +		}
    1.29  	} else {
    1.30  		ring_res->sense_len = 0;
    1.31  	}