summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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