diff options
author | Roland Dreier <roland@purestorage.com> | 2012-02-23 20:22:12 -0500 |
---|---|---|
committer | Nicholas Bellinger <nab@linux-iscsi.org> | 2012-02-25 17:37:50 -0500 |
commit | 33395fb8a13731c7ef7b175dbf5a4d8a6738fe6c (patch) | |
tree | accb78603eae5a6ebb407559d5c5546a36a8af9f /drivers/target | |
parent | 355b769e03e2a35f9dae32d95670df2fe3a6b4d2 (diff) |
target: Fix 16-bit target ports for SET TARGET PORT GROUPS emulation
The old code did (MSB << 8) & 0xff, which always evaluates to 0. Just use
get_unaligned_be16() so we don't have to worry about whether our open-coded
version is correct or not.
Signed-off-by: Roland Dreier <roland@purestorage.com>
Cc: stable@vger.kernel.org
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Diffstat (limited to 'drivers/target')
-rw-r--r-- | drivers/target/target_core_alua.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/drivers/target/target_core_alua.c b/drivers/target/target_core_alua.c index 01a2691dfb47..c7746a3339d4 100644 --- a/drivers/target/target_core_alua.c +++ b/drivers/target/target_core_alua.c | |||
@@ -30,6 +30,7 @@ | |||
30 | #include <linux/export.h> | 30 | #include <linux/export.h> |
31 | #include <scsi/scsi.h> | 31 | #include <scsi/scsi.h> |
32 | #include <scsi/scsi_cmnd.h> | 32 | #include <scsi/scsi_cmnd.h> |
33 | #include <asm/unaligned.h> | ||
33 | 34 | ||
34 | #include <target/target_core_base.h> | 35 | #include <target/target_core_base.h> |
35 | #include <target/target_core_backend.h> | 36 | #include <target/target_core_backend.h> |
@@ -267,8 +268,7 @@ int target_emulate_set_target_port_groups(struct se_task *task) | |||
267 | * changed. | 268 | * changed. |
268 | */ | 269 | */ |
269 | if (primary) { | 270 | if (primary) { |
270 | tg_pt_id = ((ptr[2] << 8) & 0xff); | 271 | tg_pt_id = get_unaligned_be16(ptr + 2); |
271 | tg_pt_id |= (ptr[3] & 0xff); | ||
272 | /* | 272 | /* |
273 | * Locate the matching target port group ID from | 273 | * Locate the matching target port group ID from |
274 | * the global tg_pt_gp list | 274 | * the global tg_pt_gp list |
@@ -312,8 +312,7 @@ int target_emulate_set_target_port_groups(struct se_task *task) | |||
312 | * the Target Port in question for the the incoming | 312 | * the Target Port in question for the the incoming |
313 | * SET_TARGET_PORT_GROUPS op. | 313 | * SET_TARGET_PORT_GROUPS op. |
314 | */ | 314 | */ |
315 | rtpi = ((ptr[2] << 8) & 0xff); | 315 | rtpi = get_unaligned_be16(ptr + 2); |
316 | rtpi |= (ptr[3] & 0xff); | ||
317 | /* | 316 | /* |
318 | * Locate the matching relative target port identifer | 317 | * Locate the matching relative target port identifer |
319 | * for the struct se_device storage object. | 318 | * for the struct se_device storage object. |