Re: [PATCH 15/36] target: Include INQUIRY length

Konstantin Shelekhin
2022-07-07T10:18:08Z

On Wed, Jul 06, 2022 at 04:35:57PM -0700, Thinh Nguyen wrote:
> «Внимание! Данное письмо от внешнего адресата!»
>
> The INQUIRY data length is minimum 36 bytes plus additional length
> jindicated in the descriptor. See SPC4-r37 section 6.6.2. The "len" here
> is the total length of the INQUIRY data. Make sure to include the 36
> initial bytes.

I think you're wrong, because Standard INQUIRY data format clearly
defines ADDITIONAL LENGTH as (n - 4), where n is the total length of the
INQUIRY data including the the mandatory bytes.

> Signed-off-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
> ---
> drivers/target/target_core_spc.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/target/target_core_spc.c b/drivers/target/target_core_spc.c
> index dd799158609d..1801e10cd575 100644
> --- a/drivers/target/target_core_spc.c
> +++ b/drivers/target/target_core_spc.c
> @@ -756,7 +756,7 @@ spc_emulate_inquiry(struct se_cmd *cmd)
> }
>
> ret = spc_emulate_inquiry_std(cmd, buf);
> - len = buf[4] + 5;
> + len = buf[4] + 5 + INQUIRY_LEN;
> goto out;
> }
>
> --
> 2.28.0
>