diff options
author | Joern Engel <joern@logfs.org> | 2014-09-02 17:49:59 -0400 |
---|---|---|
committer | Nicholas Bellinger <nab@linux-iscsi.org> | 2014-09-17 18:17:35 -0400 |
commit | 68edbce4fb4b173d3b9880967cfcce0fc3abc8d5 (patch) | |
tree | 6972d170fe734bff0c8f96f66a49cd45da4b8342 | |
parent | 1481473b5656d8841f63c455594f340306c22cb0 (diff) |
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>
-rw-r--r-- | drivers/target/target_core_fabric_lib.c | 6 |
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( | |||
394 | * If the caller wants the TransportID Length, we set that value for the | 394 | * If the caller wants the TransportID Length, we set that value for the |
395 | * entire iSCSI Tarnsport ID now. | 395 | * entire iSCSI Tarnsport ID now. |
396 | */ | 396 | */ |
397 | if (out_tid_len != NULL) { | 397 | if (out_tid_len) { |
398 | add_len = ((buf[2] >> 8) & 0xff); | 398 | /* The shift works thanks to integer promotion rules */ |
399 | add_len |= (buf[3] & 0xff); | 399 | add_len = (buf[2] << 8) | buf[3]; |
400 | 400 | ||
401 | tid_len = strlen(&buf[4]); | 401 | tid_len = strlen(&buf[4]); |
402 | tid_len += 4; /* Add four bytes for iSCSI Transport ID header */ | 402 | tid_len += 4; /* Add four bytes for iSCSI Transport ID header */ |