summaryrefslogtreecommitdiffstats
path: root/sbin
diff options
context:
space:
mode:
authormav <mav@FreeBSD.org>2013-10-11 17:10:28 +0000
committermav <mav@FreeBSD.org>2013-10-11 17:10:28 +0000
commit58e4e84a2a946159977168cd852379d56fcb3c9b (patch)
treef2bf0e8fba67db89704749b6fa162a0f40c229e4 /sbin
parentf71dcbc1ce5f213a050bde6b1f041272c9a05596 (diff)
downloadFreeBSD-src-58e4e84a2a946159977168cd852379d56fcb3c9b.zip
FreeBSD-src-58e4e84a2a946159977168cd852379d56fcb3c9b.tar.gz
MFC r256317:
Fix mode page length calculation to remove last garbage line from the `camcontrol mode daX -l` output. Approved by: re (gjb)
Diffstat (limited to 'sbin')
-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