public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] target: fix All_commands parameter data header size
@ 2025-01-15  7:07 Chaohai Chen
  2025-01-15  7:36 ` Dmitry Bogdanov
  0 siblings, 1 reply; 2+ messages in thread
From: Chaohai Chen @ 2025-01-15  7:07 UTC (permalink / raw)
  To: martin.petersen; +Cc: linux-scsi, target-devel, linux-kernel, Chaohai Chen

The SPC document states that "The COMMAND DATA LENGTH field indicates the
length in bytes of the command descriptor list".

The length should be subtracted by 4 to represent
the length of the description list, not 3

Signed-off-by: Chaohai Chen <wdhh66@163.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 ea14a3835681..61c065702350 100644
--- a/drivers/target/target_core_spc.c
+++ b/drivers/target/target_core_spc.c
@@ -2243,7 +2243,7 @@ spc_emulate_report_supp_op_codes(struct se_cmd *cmd)
 			response_length += spc_rsoc_encode_command_descriptor(
 					&buf[response_length], rctd, descr);
 		}
-		put_unaligned_be32(response_length - 3, buf);
+		put_unaligned_be32(response_length - 4, buf);
 	} else {
 		response_length = spc_rsoc_encode_one_command_descriptor(
 				&buf[response_length], rctd, descr,
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] target: fix All_commands parameter data header size
  2025-01-15  7:07 [PATCH] target: fix All_commands parameter data header size Chaohai Chen
@ 2025-01-15  7:36 ` Dmitry Bogdanov
  0 siblings, 0 replies; 2+ messages in thread
From: Dmitry Bogdanov @ 2025-01-15  7:36 UTC (permalink / raw)
  To: Chaohai Chen; +Cc: martin.petersen, linux-scsi, target-devel, linux-kernel

On Wed, Jan 15, 2025 at 03:07:39PM +0800, Chaohai Chen wrote:
> The SPC document states that "The COMMAND DATA LENGTH field indicates the
> length in bytes of the command descriptor list".
> 
> The length should be subtracted by 4 to represent
> the length of the description list, not 3
> 
> Signed-off-by: Chaohai Chen <wdhh66@163.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 ea14a3835681..61c065702350 100644
> --- a/drivers/target/target_core_spc.c
> +++ b/drivers/target/target_core_spc.c
> @@ -2243,7 +2243,7 @@ spc_emulate_report_supp_op_codes(struct se_cmd *cmd)
>                         response_length += spc_rsoc_encode_command_descriptor(
>                                         &buf[response_length], rctd, descr);
>                 }
> -               put_unaligned_be32(response_length - 3, buf);
> +               put_unaligned_be32(response_length - 4, buf);
>         } else {
>                 response_length = spc_rsoc_encode_one_command_descriptor(
>                                 &buf[response_length], rctd, descr,
> --
> 2.34.1
> 

Reviewed-by: Dmitry Bogdanov <d.bogdanov@yadro.com> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-01-15  7:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-15  7:07 [PATCH] target: fix All_commands parameter data header size Chaohai Chen
2025-01-15  7:36 ` Dmitry Bogdanov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox