Commit 108ff4c2 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] Fix scsi_report_lun_scan sign bug

We need to make the scan data unsigned, since we do

 	length = ((data[0] << 24) | (data[1] << 16) |
 		  (data[2] << 8) | (data[3] << 0));

and if data[3] is 0xff, this expression will always evaluate to
0xffffffff.  etcetera.
parent fbbef764
...@@ -899,7 +899,7 @@ static int scsi_report_lun_scan(struct scsi_device *sdev, int bflags, ...@@ -899,7 +899,7 @@ static int scsi_report_lun_scan(struct scsi_device *sdev, int bflags,
unsigned int retries; unsigned int retries;
struct scsi_lun *lunp, *lun_data; struct scsi_lun *lunp, *lun_data;
struct scsi_request *sreq; struct scsi_request *sreq;
char *data; u8 *data;
/* /*
* Only support SCSI-3 and up devices. * Only support SCSI-3 and up devices.
...@@ -990,7 +990,7 @@ static int scsi_report_lun_scan(struct scsi_device *sdev, int bflags, ...@@ -990,7 +990,7 @@ static int scsi_report_lun_scan(struct scsi_device *sdev, int bflags,
/* /*
* Get the length from the first four bytes of lun_data. * Get the length from the first four bytes of lun_data.
*/ */
data = (char *) lun_data->scsi_lun; data = (u8 *) lun_data->scsi_lun;
length = ((data[0] << 24) | (data[1] << 16) | length = ((data[0] << 24) | (data[1] << 16) |
(data[2] << 8) | (data[3] << 0)); (data[2] << 8) | (data[3] << 0));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment