Author: mav
Date: Fri Oct 25 06:04:21 2013
New Revision: 257102
URL: http://svnweb.freebsd.org/changeset/base/257102

Log:
  MFC r256317:
  Fix mode page length calculation to remove last garbage line from the
  `camcontrol mode daX -l` output.

Modified:
  stable/8/sbin/camcontrol/modeedit.c
Directory Properties:
  stable/8/sbin/camcontrol/   (props changed)

Modified: stable/8/sbin/camcontrol/modeedit.c
==============================================================================
--- stable/8/sbin/camcontrol/modeedit.c Fri Oct 25 06:03:07 2013        
(r257101)
+++ stable/8/sbin/camcontrol/modeedit.c Fri Oct 25 06:04:21 2013        
(r257102)
@@ -888,12 +888,12 @@ mode_list(struct cam_device *device, int
            timeout, data, sizeof(data));
 
        mh = (struct scsi_mode_header_6 *)data;
-       len = mh->blk_desc_len;         /* Skip block descriptors. */
+       len = sizeof(*mh) + mh->blk_desc_len;   /* Skip block descriptors. */
        /* Iterate through the pages in the reply. */
        while (len < mh->data_length) {
                /* Locate the next mode page header. */
                mph = (struct scsi_mode_page_header *)
-                   ((intptr_t)mh + sizeof(*mh) + len);
+                   ((intptr_t)mh + len);
                mode_pars = MODE_PAGE_DATA(mph);
 
                mph->page_code &= SMS_PAGE_CODE;
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to