From owner-freebsd-bugs@FreeBSD.ORG Wed Jun 3 19:54:09 2015 Return-Path: Delivered-To: freebsd-bugs@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id A36A9E for ; Wed, 3 Jun 2015 19:54:09 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2001:1900:2254:206a::16:76]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 84B9718ED for ; Wed, 3 Jun 2015 19:54:09 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from bugs.freebsd.org ([127.0.1.118]) by kenobi.freebsd.org (8.14.9/8.14.9) with ESMTP id t53Js9HC076367 for ; Wed, 3 Jun 2015 19:54:09 GMT (envelope-from bugzilla-noreply@freebsd.org) From: bugzilla-noreply@freebsd.org To: freebsd-bugs@FreeBSD.org Subject: [Bug 200619] camcontrol trashes the drive modepage if it's changed Date: Wed, 03 Jun 2015 19:54:09 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: bin X-Bugzilla-Version: 11.0-CURRENT X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Some People X-Bugzilla-Who: ngie@FreeBSD.org X-Bugzilla-Status: New X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: freebsd-bugs@FreeBSD.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version rep_platform op_sys bug_status bug_severity priority component assigned_to reporter Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Jun 2015 19:54:09 -0000 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@FreeBSD.org Reporter: ngie@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.