Blob Blame History Raw
From: Mike Christie <michael.christie@oracle.com>
Date: Wed, 1 Jul 2020 20:43:22 -0500
Subject: scsi: target: Fix iscsi transport id buf len calculation
Git-commit: bd7f65d952007adceceecece39705bb3a1b55f90
Patch-mainline: v5.9-rc1
References: bsc#1177393

The isid returned to the initiator is in string format which is 12
bytes. We also only add 1 terminating NULL and not one after the initiator
name and another one after the isid.

Link: https://lore.kernel.org/r/1593654203-12442-7-git-send-email-michael.christie@oracle.com
Signed-off-by: Mike Christie <michael.christie@oracle.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Acked-by: Lee Duncan <lduncan@suse.com>
---
 drivers/target/target_core_fabric_lib.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/target/target_core_fabric_lib.c b/drivers/target/target_core_fabric_lib.c
index 428e5a1d7e20..1d2762a99c02 100644
--- a/drivers/target/target_core_fabric_lib.c
+++ b/drivers/target/target_core_fabric_lib.c
@@ -234,7 +234,7 @@ static int iscsi_get_pr_transport_id_len(
 	 */
 	if (pr_reg->isid_present_at_reg) {
 		len += 5; /* For ",i,0x" ASCII separator */
-		len += 7; /* For iSCSI Initiator Session ID + Null terminator */
+		len += 12; /* For iSCSI Initiator Session ID */
 		*format_code = 1;
 	} else
 		*format_code = 0;