mirror of
https://github.com/SCST-project/scst.git
synced 2026-08-18 21:26:31 +00:00
PR: Compute scope field correctly
Signed-off-by: Bart Van Assche <bvanassche@acm.org> git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4643 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
@@ -1811,7 +1811,7 @@ void scst_pr_reserve(struct scst_cmd *cmd, uint8_t *buffer, int buffer_size)
|
||||
TRACE_ENTRY();
|
||||
|
||||
key = get_unaligned((__be64 *)&buffer[0]);
|
||||
scope = (cmd->cdb[2] & 0x0f) >> 4;
|
||||
scope = cmd->cdb[2] >> 4;
|
||||
type = cmd->cdb[2] & 0x0f;
|
||||
|
||||
if (buffer_size != 24) {
|
||||
@@ -1828,7 +1828,7 @@ void scst_pr_reserve(struct scst_cmd *cmd, uint8_t *buffer, int buffer_size)
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (((cmd->cdb[2] & 0x0f) >> 4) != SCOPE_LU) {
|
||||
if (scope != SCOPE_LU) {
|
||||
TRACE_PR("Invalid reservation scope %d", scope);
|
||||
scst_set_invalid_field_in_cdb(cmd, 2,
|
||||
SCST_INVAL_FIELD_BIT_OFFS_VALID | 4);
|
||||
@@ -1897,7 +1897,7 @@ void scst_pr_release(struct scst_cmd *cmd, uint8_t *buffer, int buffer_size)
|
||||
TRACE_ENTRY();
|
||||
|
||||
key = get_unaligned((__be64 *)&buffer[0]);
|
||||
scope = (cmd->cdb[2] & 0x0f) >> 4;
|
||||
scope = cmd->cdb[2] >> 4;
|
||||
type = cmd->cdb[2] & 0x0f;
|
||||
|
||||
if (buffer_size != 24) {
|
||||
@@ -2033,7 +2033,7 @@ static void scst_pr_do_preempt(struct scst_cmd *cmd, uint8_t *buffer,
|
||||
|
||||
key = get_unaligned((__be64 *)&buffer[0]);
|
||||
action_key = get_unaligned((__be64 *)&buffer[8]);
|
||||
scope = (cmd->cdb[2] & 0x0f) >> 4;
|
||||
scope = cmd->cdb[2] >> 4;
|
||||
type = cmd->cdb[2] & 0x0f;
|
||||
|
||||
if (!scst_pr_type_valid(type)) {
|
||||
|
||||
@@ -2274,7 +2274,7 @@ static int scst_persistent_reserve_out_local(struct scst_cmd *cmd)
|
||||
|
||||
/* Check scope */
|
||||
if ((action != PR_REGISTER) && (action != PR_REGISTER_AND_IGNORE) &&
|
||||
(action != PR_CLEAR) && ((cmd->cdb[2] & 0x0f) >> 4) != SCOPE_LU) {
|
||||
(action != PR_CLEAR) && (cmd->cdb[2] >> 4) != SCOPE_LU) {
|
||||
TRACE_PR("Scope must be SCOPE_LU for action %x", action);
|
||||
scst_set_cmd_error(cmd,
|
||||
SCST_LOAD_SENSE(scst_sense_invalid_field_in_cdb));
|
||||
|
||||
Reference in New Issue
Block a user