public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
* [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

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