aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/scsi_scan.c
diff options
context:
space:
mode:
authorRob Evers <revers@redhat.com>2014-12-16 11:01:19 -0500
committerChristoph Hellwig <hch@lst.de>2015-01-09 09:44:16 -0500
commit2a904e5dd9b832fe70d86b70ce6e273d67e94389 (patch)
treeb726065366875a8d330ae5c469f512244682502d /drivers/scsi/scsi_scan.c
parenteb9eea01d4d8ce86eeee52cdd40029fd1a549721 (diff)
scsi: use set/get_unaligned_be32 in report_luns
Signed-off-by: Rob Evers <revers@redhat.com> Reviewed-by: Ewan D. Milne <emilne@redhat.com> Signed-off-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'drivers/scsi/scsi_scan.c')
-rw-r--r--drivers/scsi/scsi_scan.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c
index 9edae2f3e879..b7948d20c23b 100644
--- a/drivers/scsi/scsi_scan.c
+++ b/drivers/scsi/scsi_scan.c
@@ -34,6 +34,7 @@
34#include <linux/spinlock.h> 34#include <linux/spinlock.h>
35#include <linux/async.h> 35#include <linux/async.h>
36#include <linux/slab.h> 36#include <linux/slab.h>
37#include <asm/unaligned.h>
37 38
38#include <scsi/scsi.h> 39#include <scsi/scsi.h>
39#include <scsi/scsi_cmnd.h> 40#include <scsi/scsi_cmnd.h>
@@ -1367,7 +1368,6 @@ static int scsi_report_lun_scan(struct scsi_target *starget, int bflags,
1367 unsigned int retries; 1368 unsigned int retries;
1368 int result; 1369 int result;
1369 struct scsi_lun *lunp, *lun_data; 1370 struct scsi_lun *lunp, *lun_data;
1370 u8 *data;
1371 struct scsi_sense_hdr sshdr; 1371 struct scsi_sense_hdr sshdr;
1372 struct scsi_device *sdev; 1372 struct scsi_device *sdev;
1373 struct Scsi_Host *shost = dev_to_shost(&starget->dev); 1373 struct Scsi_Host *shost = dev_to_shost(&starget->dev);
@@ -1433,10 +1433,7 @@ static int scsi_report_lun_scan(struct scsi_target *starget, int bflags,
1433 /* 1433 /*
1434 * bytes 6 - 9: length of the command. 1434 * bytes 6 - 9: length of the command.
1435 */ 1435 */
1436 scsi_cmd[6] = (unsigned char) (length >> 24) & 0xff; 1436 put_unaligned_be32(length, &scsi_cmd[6]);
1437 scsi_cmd[7] = (unsigned char) (length >> 16) & 0xff;
1438 scsi_cmd[8] = (unsigned char) (length >> 8) & 0xff;
1439 scsi_cmd[9] = (unsigned char) length & 0xff;
1440 1437
1441 scsi_cmd[10] = 0; /* reserved */ 1438 scsi_cmd[10] = 0; /* reserved */
1442 scsi_cmd[11] = 0; /* control */ 1439 scsi_cmd[11] = 0; /* control */
@@ -1484,9 +1481,7 @@ static int scsi_report_lun_scan(struct scsi_target *starget, int bflags,
1484 /* 1481 /*
1485 * Get the length from the first four bytes of lun_data. 1482 * Get the length from the first four bytes of lun_data.
1486 */ 1483 */
1487 data = (u8 *) lun_data->scsi_lun; 1484 length = get_unaligned_be32(lun_data->scsi_lun);
1488 length = ((data[0] << 24) | (data[1] << 16) |
1489 (data[2] << 8) | (data[3] << 0));
1490 1485
1491 num_luns = (length / sizeof(struct scsi_lun)); 1486 num_luns = (length / sizeof(struct scsi_lun));
1492 if (num_luns > max_scsi_report_luns) { 1487 if (num_luns > max_scsi_report_luns) {