svn commit: r256317 - head/sbin/camcontrol

Alexander Motin mav at FreeBSD.org
Fri Oct 11 17:00:10 UTC 2013


Author: mav
Date: Fri Oct 11 17:00:09 2013
New Revision: 256317
URL: http://svnweb.freebsd.org/changeset/base/256317

Log:
  Fix mode page length calculation to remove last garbage line from the
  `camcontrol mode daX -l` output.
  
  PR
  Approved by:	re (gjb)
  MFC after:	2 weeks

Modified:
  head/sbin/camcontrol/modeedit.c

Modified: head/sbin/camcontrol/modeedit.c
==============================================================================
--- head/sbin/camcontrol/modeedit.c	Fri Oct 11 15:06:13 2013	(r256316)
+++ head/sbin/camcontrol/modeedit.c	Fri Oct 11 17:00:09 2013	(r256317)
@@ -886,12 +886,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);
 
 		mph->page_code &= SMS_PAGE_CODE;
 		nameentry = nameentry_lookup(mph->page_code);


More information about the svn-src-all mailing list