[Bug 200619] camcontrol trashes the drive modepage if it's changed
bugzilla-noreply at freebsd.org
bugzilla-noreply at freebsd.org
Wed Jun 3 19:54:09 UTC 2015
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=200619
Bug ID: 200619
Summary: camcontrol trashes the drive modepage if it's changed
Product: Base System
Version: 11.0-CURRENT
Hardware: Any
OS: Any
Status: New
Severity: Affects Some People
Priority: ---
Component: bin
Assignee: freebsd-bugs at FreeBSD.org
Reporter: ngie at FreeBSD.org
Description
===========
Something is broken in camcontrol in bsd10.
It trashes a drive modepage if it changed.
Here is some sample output.
ls-10-min252-1# isi_radish -e
camcontrol: value 0 is out of range for entry Report Count; clipping to -1
This will happen for other values if you attempt to change them as well.
ls-10-min252-1# echo -e "Interval Timer: 1800" | camcontrol modepage da4 -m
0x1c -P 3 -e
camcontrol: value 1800 is out of range for entry Interval Timer; clipping to -1
ls-10-min252-1# camcontrol modepage da4 -m 0x1c -P 3
Interval Timer: -1258291201
The line of code that fixes this is changing....
#define RESOLUTION_MAX(size) ((resolution * (size) == 32)? \
(int)0xffffffff: (1 << (resolution * (size))) - 1)
to
#define RESOLUTION_MAX(size) ((resolution * (size) == 32)? \
INT_MAX: (1 << (resolution * (size))) - 1)
Even with this change in place the error goes away, but the value reported by
cam control after "changing" the modepage field does not change.
Essentially changing mode page fields is broken.
Proposed Fix
============
diff --git a/sbin/camcontrol/modeedit.c b/sbin/camcontrol/modeedit.c
index 00ab974..8262c3c 100644
--- a/sbin/camcontrol/modeedit.c
+++ b/sbin/camcontrol/modeedit.c
@@ -246,7 +246,7 @@ editentry_set(char *name, char *newvalue, int editonly)
* currently workaround it (even for int64's), so we have to kludge it.
*/
#define RESOLUTION_MAX(size) ((resolution * (size) == 32)?
\
- (int)0xffffffff: (1 << (resolution * (size))) - 1)
+ INT_MAX: (1 << (resolution * (size))) - 1)
assert(newvalue != NULL);
if (*newvalue == '\0')
diff --git a/share/misc/scsi_modes b/share/misc/scsi_modes
index 781b8f1..80752e7 100644
--- a/share/misc/scsi_modes
+++ b/share/misc/scsi_modes
@@ -106,7 +106,7 @@
{EBACKERR} t1
{LogErr} t1
{Reserved} *t4
- {MRIE} b4
+ {MRIE} t4
{Interval Timer} i4
{Report Count} i4
}
Reported by: Michael Baptist
Submitted by: Lars Skodje
Sponsored by: EMC / Isilon Storage Division
--
You are receiving this mail because:
You are the assignee for the bug.
More information about the freebsd-bugs
mailing list