From a83e8ce5c0dced21f79d44125e2ddec84325595f Mon Sep 17 00:00:00 2001 From: chessman Date: Wed, 3 Jul 2019 19:34:49 +0300 Subject: [PATCH] REPORT LUNS: truncate response by allocation length --- pkg/scsi/spc.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pkg/scsi/spc.go b/pkg/scsi/spc.go index c4759b7..0aa8846 100644 --- a/pkg/scsi/spc.go +++ b/pkg/scsi/spc.go @@ -404,7 +404,6 @@ sense: func SPCReportLuns(host int, cmd *api.SCSICommand) api.SAMStat { var ( remainLength uint32 - actualLength uint32 = 8 availLength uint32 = 0 allocationLength uint32 buf *bytes.Buffer = &bytes.Buffer{} @@ -425,7 +424,7 @@ func SPCReportLuns(host int, cmd *api.SCSICommand) api.SAMStat { // LUN list length buf.Write(util.MarshalUint32(availLength)) - cmd.InSDBBuffer.Resid = uint32(actualLength) + cmd.InSDBBuffer.Resid = allocationLength // Skip through to byte 4, Reserved for i := 0; i < 4; i++ {