* [PATCH] sg: limit maximum cdb size to 252 bytes
@ 2014-06-25 17:05 Douglas Gilbert
2014-06-26 2:19 ` Martin K. Petersen
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Douglas Gilbert @ 2014-06-25 17:05 UTC (permalink / raw)
To: SCSI development list, Christoph Hellwig; +Cc: Boaz Harrosh
[-- Attachment #1: Type: text/plain, Size: 549 bytes --]
Boaz Harrosh commented on the "[PATCH v5] sg: relax 16
byte cdb restriction" thread that SCSI variable length
commands (which are all SCSI commands greater than 16
bytes long) must themselves be a multiple of 4 bytes
long.
ChangeLog
- limit the maximum cdb size permitted by the sg
v3 interface to 252 bytes. Commands that large
are called "variable length" and their length
needs to be a multiple of 4.
Original patch:
Reviewed-by: Boaz Harrosh <boaz@electrozaur.com>
Signed-off-by: Douglas Gilbert <dgilbert@interlog.com>
[-- Attachment #2: sg_cdb252.patch --]
[-- Type: text/x-patch, Size: 629 bytes --]
diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c
index b6d183a..2e01a9d 100644
--- a/drivers/scsi/sg.c
+++ b/drivers/scsi/sg.c
@@ -74,9 +74,10 @@ static void sg_proc_cleanup(void);
#define SG_MAX_DEVS 32768
/* SG_MAX_CDB_SIZE should be 260 (spc4r37 section 3.1.30) however the type
- * of sg_io_hdr::cmd_len can only represent 255
+ * of sg_io_hdr::cmd_len can only represent 255. All SCSI commands greater
+ * than 16 bytes are "variable length" whose length is a multiple of 4
*/
-#define SG_MAX_CDB_SIZE 255
+#define SG_MAX_CDB_SIZE 252
/*
* Suppose you want to calculate the formula muldiv(x,m,d)=int(x * m / d)
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] sg: limit maximum cdb size to 252 bytes
2014-06-25 17:05 [PATCH] sg: limit maximum cdb size to 252 bytes Douglas Gilbert
@ 2014-06-26 2:19 ` Martin K. Petersen
2014-06-26 7:38 ` Christoph Hellwig
2014-06-26 14:57 ` Ewan Milne
2 siblings, 0 replies; 4+ messages in thread
From: Martin K. Petersen @ 2014-06-26 2:19 UTC (permalink / raw)
To: Douglas Gilbert; +Cc: SCSI development list, Christoph Hellwig, Boaz Harrosh
>>>>> "Doug" == Douglas Gilbert <dgilbert@interlog.com> writes:
Doug> Boaz Harrosh commented on the "[PATCH v5] sg: relax 16 byte cdb
Doug> restriction" thread that SCSI variable length commands (which are
Doug> all SCSI commands greater than 16 bytes long) must themselves be a
Doug> multiple of 4 bytes long.
Doug> ChangeLog
Doug> - limit the maximum cdb size permitted by the sg
Doug> v3 interface to 252 bytes. Commands that large are called
Doug> "variable length" and their length needs to be a multiple of
Doug> 4.
Doug> Original patch:
Doug> Reviewed-by: Boaz Harrosh <boaz@electrozaur.com>
Doug> Signed-off-by: Douglas Gilbert <dgilbert@interlog.com>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
--
Martin K. Petersen Oracle Linux Engineering
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] sg: limit maximum cdb size to 252 bytes
2014-06-25 17:05 [PATCH] sg: limit maximum cdb size to 252 bytes Douglas Gilbert
2014-06-26 2:19 ` Martin K. Petersen
@ 2014-06-26 7:38 ` Christoph Hellwig
2014-06-26 14:57 ` Ewan Milne
2 siblings, 0 replies; 4+ messages in thread
From: Christoph Hellwig @ 2014-06-26 7:38 UTC (permalink / raw)
To: Douglas Gilbert; +Cc: SCSI development list, Christoph Hellwig, Boaz Harrosh
Looks good,
Reviewed-by: Christoph Hellwig <hch@lst.de>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] sg: limit maximum cdb size to 252 bytes
2014-06-25 17:05 [PATCH] sg: limit maximum cdb size to 252 bytes Douglas Gilbert
2014-06-26 2:19 ` Martin K. Petersen
2014-06-26 7:38 ` Christoph Hellwig
@ 2014-06-26 14:57 ` Ewan Milne
2 siblings, 0 replies; 4+ messages in thread
From: Ewan Milne @ 2014-06-26 14:57 UTC (permalink / raw)
To: dgilbert; +Cc: SCSI development list, Christoph Hellwig, Boaz Harrosh
On Wed, 2014-06-25 at 13:05 -0400, Douglas Gilbert wrote:
> Boaz Harrosh commented on the "[PATCH v5] sg: relax 16
> byte cdb restriction" thread that SCSI variable length
> commands (which are all SCSI commands greater than 16
> bytes long) must themselves be a multiple of 4 bytes
> long.
>
> ChangeLog
> - limit the maximum cdb size permitted by the sg
> v3 interface to 252 bytes. Commands that large
> are called "variable length" and their length
> needs to be a multiple of 4.
>
> Original patch:
> Reviewed-by: Boaz Harrosh <boaz@electrozaur.com>
>
> Signed-off-by: Douglas Gilbert <dgilbert@interlog.com>
>
Sure.
Reviewed-by: Ewan D. Milne <emilne@redhat.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-06-26 14:57 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-25 17:05 [PATCH] sg: limit maximum cdb size to 252 bytes Douglas Gilbert
2014-06-26 2:19 ` Martin K. Petersen
2014-06-26 7:38 ` Christoph Hellwig
2014-06-26 14:57 ` Ewan Milne
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox