Blame SOURCES/sg_rdac_additional_upstream_fixes.patch

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