All of lore.kernel.org
 help / color / mirror / Atom feed
From: Douglas Gilbert <dgilbert@interlog.com>
To: SCSI development list <linux-scsi@vger.kernel.org>,
	Christoph Hellwig <hch@lst.de>
Cc: Boaz Harrosh <bharrosh@panasas.com>
Subject: [PATCH] sg: limit maximum cdb size to 252 bytes
Date: Wed, 25 Jun 2014 13:05:42 -0400	[thread overview]
Message-ID: <53AB0166.8060905@interlog.com> (raw)

[-- 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)

             reply	other threads:[~2014-06-25 17:05 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-25 17:05 Douglas Gilbert [this message]
2014-06-26  2:19 ` [PATCH] sg: limit maximum cdb size to 252 bytes Martin K. Petersen
2014-06-26  7:38 ` Christoph Hellwig
2014-06-26 14:57 ` Ewan Milne

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=53AB0166.8060905@interlog.com \
    --to=dgilbert@interlog.com \
    --cc=bharrosh@panasas.com \
    --cc=hch@lst.de \
    --cc=linux-scsi@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.