diff options
author | Joern Engel <joern@logfs.org> | 2014-09-02 23:49:59 +0200 |
---|---|---|
committer | Nicholas Bellinger <nab@linux-iscsi.org> | 2014-09-18 00:17:35 +0200 |
commit | 68edbce4fb4b173d3b9880967cfcce0fc3abc8d5 (patch) | |
tree | 6972d170fe734bff0c8f96f66a49cd45da4b8342 /drivers/target | |
parent | target: simplify target_fabric_make_lun error path (diff) | |
download | linux-68edbce4fb4b173d3b9880967cfcce0fc3abc8d5.tar.xz 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.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( * 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 */ |