diff options
author | Mike Christie <michaelc@cs.wisc.edu> | 2007-02-28 18:32:19 -0500 |
---|---|---|
committer | James Bottomley <jejb@mulgrave.il.steeleye.com> | 2007-03-11 12:28:09 -0400 |
commit | 8eb00539d92187ade7e4cc24a1a36ab248ee8639 (patch) | |
tree | 06a0817931d57f5e8b0439761981798f17c2396a /drivers/scsi/libiscsi.c | |
parent | 41be14442213b6dbeea3cba2ed18a2923666278c (diff) |
[SCSI] libiscsi: use get_unaligned
Dave Miller meantioned that the data buffer in a past
sense fixup patch was not gauranteed to be aligned
properly for ia64. This patch has libiscsi use get_unalinged
to make sure. There are a couple more places in the
digest handling we may need to do this, but we are in the middle
of fixing that code for big endien systems so just the sense
access is fixed here.
Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/scsi/libiscsi.c')
-rw-r--r-- | drivers/scsi/libiscsi.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c index 04707d667c9d..3f5b9b445b29 100644 --- a/drivers/scsi/libiscsi.c +++ b/drivers/scsi/libiscsi.c | |||
@@ -25,6 +25,7 @@ | |||
25 | #include <linux/mutex.h> | 25 | #include <linux/mutex.h> |
26 | #include <linux/kfifo.h> | 26 | #include <linux/kfifo.h> |
27 | #include <linux/delay.h> | 27 | #include <linux/delay.h> |
28 | #include <asm/unaligned.h> | ||
28 | #include <net/tcp.h> | 29 | #include <net/tcp.h> |
29 | #include <scsi/scsi_cmnd.h> | 30 | #include <scsi/scsi_cmnd.h> |
30 | #include <scsi/scsi_device.h> | 31 | #include <scsi/scsi_device.h> |
@@ -269,14 +270,14 @@ invalid_datalen: | |||
269 | goto out; | 270 | goto out; |
270 | } | 271 | } |
271 | 272 | ||
272 | senselen = be16_to_cpu(*(__be16 *)data); | 273 | senselen = be16_to_cpu(get_unaligned((__be16 *) data)); |
273 | if (datalen < senselen) | 274 | if (datalen < senselen) |
274 | goto invalid_datalen; | 275 | goto invalid_datalen; |
275 | 276 | ||
276 | memcpy(sc->sense_buffer, data + 2, | 277 | memcpy(sc->sense_buffer, data + 2, |
277 | min_t(uint16_t, senselen, SCSI_SENSE_BUFFERSIZE)); | 278 | min_t(uint16_t, senselen, SCSI_SENSE_BUFFERSIZE)); |
278 | debug_scsi("copied %d bytes of sense\n", | 279 | debug_scsi("copied %d bytes of sense\n", |
279 | min(senselen, SCSI_SENSE_BUFFERSIZE)); | 280 | min_t(uint16_t, senselen, SCSI_SENSE_BUFFERSIZE)); |
280 | } | 281 | } |
281 | 282 | ||
282 | if (sc->sc_data_direction == DMA_TO_DEVICE) | 283 | if (sc->sc_data_direction == DMA_TO_DEVICE) |