39359f
diff --git a/doc/sg_rdac.8 b/doc/sg_rdac.8
39359f
index 8e3d27a..cac0776 100644
39359f
--- a/doc/sg_rdac.8
39359f
+++ b/doc/sg_rdac.8
39359f
@@ -19,6 +19,8 @@ Transfer all (visible) devices
39359f
 \fB\-f\fR=\fILUN\fR
39359f
 Transfer the device identified by \fILUN\fR. This command will only work
39359f
 if the controller supports 'Dual Active Mode' (aka active/active mode).
39359f
+\fILUN\fR is a decimal number which cannot exceed 31 when the \fI\-6\fR
39359f
+option is given, otherwise is cannot exceed 255.
39359f
 .TP
39359f
 \fB\-v\fR
39359f
 be verbose
39359f
@@ -33,7 +35,7 @@ Written by Hannes Reinecke <hare at suse dot com>, based on sg_emc_trespass.
39359f
 .SH "REPORTING BUGS"
39359f
 Report bugs to <dgilbert at interlog dot com>.
39359f
 .SH COPYRIGHT
39359f
-Copyright \(co 2006\-2012 Hannes Reinecke, Douglas Gilbert.
39359f
+Copyright \(co 2006\-2016 Hannes Reinecke, Douglas Gilbert.
39359f
 .br
39359f
 This software is distributed under the GPL version 2. There is NO
39359f
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
39359f
diff --git a/src/sg_rdac.c b/src/sg_rdac.c
39359f
index ea243a2..63cfe46 100644
39359f
--- a/src/sg_rdac.c
39359f
+++ b/src/sg_rdac.c
39359f
@@ -188,9 +188,16 @@ static int fail_this_path(int fd, int lun, int use_6_byte)
39359f
         struct rdac_page_common *rdac_common = NULL;
39359f
         int res;
39359f
 
39359f
-        if (use_6_byte && lun > 32) {
39359f
-                fprintf(stderr, "must use 10 byte cdb to fail luns over 32\n");
39359f
-                return -1;
39359f
+        if (use_6_byte) {
39359f
+                if (lun > 31) {
39359f
+                        fprintf(stderr, "must use 10 byte cdb to fail luns over 31\n");
39359f
+                        return -1;
39359f
+                }
39359f
+        } else {        /* 10 byte cdb case */
39359f
+                if (lun > 255) {
39359f
+                        fprintf(stderr, "lun cannot exceed 255\n");
39359f
+                        return -1;
39359f
+                }
39359f
         }
39359f
 
39359f
         memset(fail_paths_pg, 0, 308);