From 4d92568a983d1f4c8d0d471102d6c61bd5eb3b3d Mon Sep 17 00:00:00 2001 From: mav Date: Fri, 25 Oct 2013 06:03:07 +0000 Subject: [PATCH] MFC r256317: Fix mode page length calculation to remove last garbage line from the `camcontrol mode daX -l` output. git-svn-id: svn://svn.freebsd.org/base/stable/9@257101 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f --- sbin/camcontrol/modeedit.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sbin/camcontrol/modeedit.c b/sbin/camcontrol/modeedit.c index 8504208cf..00ab97404 100644 --- a/sbin/camcontrol/modeedit.c +++ b/sbin/camcontrol/modeedit.c @@ -886,12 +886,12 @@ mode_list(struct cam_device *device, int page_control, int dbd, 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); -- 2.45.0