diff options
author | Roland Dreier <roland@purestorage.com> | 2012-02-23 17:22:12 -0800 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-04-02 10:32:06 -0700 |
commit | 527a832cda6dbe7ac3a38dcceb7fe422a7980e13 (patch) | |
tree | 5d320649b50bb64c0c7ad185f75c272284306ae9 /drivers | |
parent | 3b5e7a259c88befb754607dcabd14b4f01bef212 (diff) | |
download | lwn-527a832cda6dbe7ac3a38dcceb7fe422a7980e13.tar.gz lwn-527a832cda6dbe7ac3a38dcceb7fe422a7980e13.zip |
target: Fix 16-bit target ports for SET TARGET PORT GROUPS emulation
commit 33395fb8a13731c7ef7b175dbf5a4d8a6738fe6c upstream.
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>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers')
-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 @@ #include <linux/export.h> #include <scsi/scsi.h> #include <scsi/scsi_cmnd.h> +#include <asm/unaligned.h> #include <target/target_core_base.h> #include <target/target_core_backend.h> @@ -267,8 +268,7 @@ int target_emulate_set_target_port_groups(struct se_task *task) * changed. */ if (primary) { - tg_pt_id = ((ptr[2] << 8) & 0xff); - tg_pt_id |= (ptr[3] & 0xff); + tg_pt_id = get_unaligned_be16(ptr + 2); /* * Locate the matching target port group ID from * the global tg_pt_gp list @@ -312,8 +312,7 @@ int target_emulate_set_target_port_groups(struct se_task *task) * the Target Port in question for the the incoming * SET_TARGET_PORT_GROUPS op. */ - rtpi = ((ptr[2] << 8) & 0xff); - rtpi |= (ptr[3] & 0xff); + rtpi = get_unaligned_be16(ptr + 2); /* * Locate the matching relative target port identifer * for the struct se_device storage object. |