From 982e4d1938e7ca05592ea219a7ef9866313a54de Mon Sep 17 00:00:00 2001 From: Vladislav Bolkhovitin Date: Tue, 3 Mar 2009 17:04:12 +0000 Subject: [PATCH] Bufflen can be changed after scst_get_cdb_info(), so for bufflen = 0 data_direction should be changed to SCST_DATA_NONE not in scst_get_cdb_info(), but in the end of parsing. git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@683 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scst/src/scst_lib.c | 8 -------- scst/src/scst_targ.c | 8 ++++++++ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/scst/src/scst_lib.c b/scst/src/scst_lib.c index 5d6a80020..bf8d0d2ec 100644 --- a/scst/src/scst_lib.c +++ b/scst/src/scst_lib.c @@ -2020,14 +2020,6 @@ int scst_get_cdb_info(struct scst_cmd *cmd) cmd->op_flags = ptr->flags; res = (*ptr->get_trans_len)(cmd, ptr->off); - if (cmd->bufflen == 0) { - /* - * According to SPC bufflen 0 for data transfer commands isn't - * an error, so we need to fix the transfer direction. - */ - cmd->data_direction = SCST_DATA_NONE; - } - out: TRACE_EXIT(); return res; diff --git a/scst/src/scst_targ.c b/scst/src/scst_targ.c index 17daad9a8..b4c4e48be 100644 --- a/scst/src/scst_targ.c +++ b/scst/src/scst_targ.c @@ -526,6 +526,14 @@ static int scst_parse_cmd(struct scst_cmd *cmd) if (cmd->data_len == -1) cmd->data_len = cmd->bufflen; + if (cmd->bufflen == 0) { + /* + * According to SPC bufflen 0 for data transfer commands isn't + * an error, so we need to fix the transfer direction. + */ + cmd->data_direction = SCST_DATA_NONE; + } + if (cmd->dh_data_buf_alloced && unlikely((orig_bufflen > cmd->bufflen))) { PRINT_ERROR("Dev handler supplied data buffer (size %d), "