diff mbox

[1/3] scsi: Fix wrong additional sense length in descriptor format

Message ID 1436697423-20611-2-git-send-email-sagig@mellanox.com (mailing list archive)
State New, archived
Headers show

Commit Message

Sagi Grimberg July 12, 2015, 10:37 a.m. UTC
The sense header additional sense length should be the accumulated
size of all the descriptors. Information descriptor size is 12 bytes.
When setting the additional sense length we should add 0xc instead of
0xa.

Signed-off-by: Sagi Grimberg <sagig@mellanox.com>
---
 drivers/scsi/scsi_common.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Hannes Reinecke July 13, 2015, 2:05 p.m. UTC | #1
On 07/12/2015 12:37 PM, Sagi Grimberg wrote:
> The sense header additional sense length should be the accumulated
> size of all the descriptors. Information descriptor size is 12 bytes.
> When setting the additional sense length we should add 0xc instead of
> 0xa.
> 
> Signed-off-by: Sagi Grimberg <sagig@mellanox.com>
> ---
>  drivers/scsi/scsi_common.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/scsi/scsi_common.c b/drivers/scsi/scsi_common.c
> index 8cfb7ee..fbf137b 100644
> --- a/drivers/scsi/scsi_common.c
> +++ b/drivers/scsi/scsi_common.c
> @@ -260,7 +260,7 @@ void scsi_set_sense_information(u8 *buf, u64 info)
>  		len = buf[7];
>  		ucp = (char *)scsi_sense_desc_find(buf, len + 8, 0);
>  		if (!ucp) {
> -			buf[7] = len + 0xa;
> +			buf[7] = len + 0xc;
>  			ucp = buf + 8 + len;
>  		}
>  		ucp[0] = 0;
> 
Reviewed-by: Hannes Reinecke <hare@suse.de>

Cheers,

Hannes
Martin K. Petersen July 14, 2015, 12:52 a.m. UTC | #2
>>>>> "Sagi" == Sagi Grimberg <sagig@mellanox.com> writes:

Sagi> The sense header additional sense length should be the accumulated
Sagi> size of all the descriptors. Information descriptor size is 12
Sagi> bytes.  When setting the additional sense length we should add 0xc
Sagi> instead of 0xa.

Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
diff mbox

Patch

diff --git a/drivers/scsi/scsi_common.c b/drivers/scsi/scsi_common.c
index 8cfb7ee..fbf137b 100644
--- a/drivers/scsi/scsi_common.c
+++ b/drivers/scsi/scsi_common.c
@@ -260,7 +260,7 @@  void scsi_set_sense_information(u8 *buf, u64 info)
 		len = buf[7];
 		ucp = (char *)scsi_sense_desc_find(buf, len + 8, 0);
 		if (!ucp) {
-			buf[7] = len + 0xa;
+			buf[7] = len + 0xc;
 			ucp = buf + 8 + len;
 		}
 		ucp[0] = 0;