diff mbox series

[15/36] target: Include INQUIRY length

Message ID 2557ef61dddba5056b9d89d73248bf4140e92f19.1657149962.git.Thinh.Nguyen@synopsys.com (mailing list archive)
State Superseded
Headers show
Series usb: gadget: f_tcm: Enhance UASP driver | expand

Commit Message

Thinh Nguyen July 6, 2022, 11:35 p.m. UTC
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.

Signed-off-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
---
 drivers/target/target_core_spc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Konstantin Shelekhin July 7, 2022, 10:11 a.m. UTC | #1
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
>
Thinh Nguyen July 14, 2022, 1:42 a.m. UTC | #2
On 7/7/2022, Konstantin Shelekhin wrote:
> 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.
>   

Looks like you're right. I mixed it up with Sense data ADDITIONAL LENGTH.

Thanks,
Thinh

>> 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
>>
diff mbox series

Patch

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;
 	}