diff mbox

target:fix the return sense reason when parameter list length error in target_scsi3_emulate_pr_out

Message ID 1499484505-828-1-git-send-email-tang.wenji@zte.com.cn (mailing list archive)
State New, archived
Headers show

Commit Message

tang.wenji@zte.com.cn July 8, 2017, 3:28 a.m. UTC
From: Tang Wenji <tang.wenji@zte.com.cn>

The sense reason should be TCM_PARAMETER_LIST_LENGTH_ERROR when parmeter length error. Also the  cdb[1] & 0x1f has been assigned to local variable sa,so use sa instead of it.

Signed-off-by: Tang Wenji <tang.wenji@zte.com.cn>
---
 drivers/target/target_core_pr.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

Comments

Nicholas A. Bellinger July 10, 2017, 4:01 a.m. UTC | #1
On Sat, 2017-07-08 at 11:28 +0800, tang.wenji@zte.com.cn wrote:
> From: Tang Wenji <tang.wenji@zte.com.cn>
> 
> The sense reason should be TCM_PARAMETER_LIST_LENGTH_ERROR when parmeter length error. Also the  cdb[1] & 0x1f has been assigned to local variable sa,so use sa instead of it.
> 
> Signed-off-by: Tang Wenji <tang.wenji@zte.com.cn>
> ---
>  drivers/target/target_core_pr.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 

Applied to target-pending/for-next.

Thanks Tang.

--
To unsubscribe from this list: send the line "unsubscribe target-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/target/target_core_pr.c b/drivers/target/target_core_pr.c
index 9921d4d..6d5def6 100644
--- a/drivers/target/target_core_pr.c
+++ b/drivers/target/target_core_pr.c
@@ -3585,7 +3585,7 @@  target_scsi3_emulate_pr_out(struct se_cmd *cmd)
 	if (cmd->data_length < 24) {
 		pr_warn("SPC-PR: Received PR OUT parameter list"
 			" length too small: %u\n", cmd->data_length);
-		return TCM_INVALID_PARAMETER_LIST;
+		return TCM_PARAMETER_LIST_LENGTH_ERROR;
 	}
 
 	/*
@@ -3629,7 +3629,7 @@  target_scsi3_emulate_pr_out(struct se_cmd *cmd)
 	/*
 	 * SPEC_I_PT=1 is only valid for Service action: REGISTER
 	 */
-	if (spec_i_pt && ((cdb[1] & 0x1f) != PRO_REGISTER))
+	if (spec_i_pt && (sa != PRO_REGISTER))
 		return TCM_INVALID_PARAMETER_LIST;
 
 	/*
@@ -3641,11 +3641,11 @@  target_scsi3_emulate_pr_out(struct se_cmd *cmd)
 	 * the sense key set to ILLEGAL REQUEST, and the additional sense
 	 * code set to PARAMETER LIST LENGTH ERROR.
 	 */
-	if (!spec_i_pt && ((cdb[1] & 0x1f) != PRO_REGISTER_AND_MOVE) &&
+	if (!spec_i_pt && (sa != PRO_REGISTER_AND_MOVE) &&
 	    (cmd->data_length != 24)) {
 		pr_warn("SPC-PR: Received PR OUT illegal parameter"
 			" list length: %u\n", cmd->data_length);
-		return TCM_INVALID_PARAMETER_LIST;
+		return TCM_PARAMETER_LIST_LENGTH_ERROR;
 	}
 
 	/*
@@ -3685,7 +3685,7 @@  target_scsi3_emulate_pr_out(struct se_cmd *cmd)
 		break;
 	default:
 		pr_err("Unknown PERSISTENT_RESERVE_OUT service"
-			" action: 0x%02x\n", cdb[1] & 0x1f);
+			" action: 0x%02x\n", sa);
 		return TCM_INVALID_CDB_FIELD;
 	}