summaryrefslogtreecommitdiffstats
path: root/drivers/target
diff options
context:
space:
mode:
authorJoern Engel <joern@logfs.org>2014-09-02 17:49:59 -0400
committerNicholas Bellinger <nab@linux-iscsi.org>2014-09-17 15:17:35 -0700
commit68edbce4fb4b173d3b9880967cfcce0fc3abc8d5 (patch)
tree6972d170fe734bff0c8f96f66a49cd45da4b8342 /drivers/target
parent1481473b5656d8841f63c455594f340306c22cb0 (diff)
downloadblackbird-op-linux-68edbce4fb4b173d3b9880967cfcce0fc3abc8d5.tar.gz
blackbird-op-linux-68edbce4fb4b173d3b9880967cfcce0fc3abc8d5.zip
target: fix pr_out length in iscsi_parse_pr_out_transport_id
Old code in iscsi_parse_pr_out_transport_id() was obviously buggy and effectively ignored the high byte. Found by coverity. Signed-off-by: Joern Engel <joern@logfs.org> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Diffstat (limited to 'drivers/target')
-rw-r--r--drivers/target/target_core_fabric_lib.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/target/target_core_fabric_lib.c b/drivers/target/target_core_fabric_lib.c
index 0d1cf8b4f49f..35bfe77160d8 100644
--- a/drivers/target/target_core_fabric_lib.c
+++ b/drivers/target/target_core_fabric_lib.c
@@ -394,9 +394,9 @@ char *iscsi_parse_pr_out_transport_id(
* If the caller wants the TransportID Length, we set that value for the
* entire iSCSI Tarnsport ID now.
*/
- if (out_tid_len != NULL) {
- add_len = ((buf[2] >> 8) & 0xff);
- add_len |= (buf[3] & 0xff);
+ if (out_tid_len) {
+ /* The shift works thanks to integer promotion rules */
+ add_len = (buf[2] << 8) | buf[3];
tid_len = strlen(&buf[4]);
tid_len += 4; /* Add four bytes for iSCSI Transport ID header */
OpenPOWER on IntegriCloud