Skip to content

Commit

Permalink
target: fix pr_out length in iscsi_parse_pr_out_transport_id
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Joern Engel authored and Nicholas Bellinger committed Sep 17, 2014
1 parent 1481473 commit 68edbce
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions drivers/target/target_core_fabric_lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down

0 comments on commit 68edbce

Please sign in to comment.