summaryrefslogtreecommitdiffstats
path: root/sbin/camcontrol
diff options
context:
space:
mode:
authormav <mav@FreeBSD.org>2013-10-11 17:00:09 +0000
committermav <mav@FreeBSD.org>2013-10-11 17:00:09 +0000
commit609a7ca2e0b1a24e04260a52eb7577532d38a1e0 (patch)
treef8cf938b491978ab903f47868332d319d41034a8 /sbin/camcontrol
parente1d63ae83c6e572c6c11ebd089c0ae91e0df59b7 (diff)
downloadFreeBSD-src-609a7ca2e0b1a24e04260a52eb7577532d38a1e0.zip
FreeBSD-src-609a7ca2e0b1a24e04260a52eb7577532d38a1e0.tar.gz
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
Diffstat (limited to 'sbin/camcontrol')
-rw-r--r--sbin/camcontrol/modeedit.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sbin/camcontrol/modeedit.c b/sbin/camcontrol/modeedit.c
index 8504208..00ab974 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);
OpenPOWER on IntegriCloud