1
0
mirror of https://git.FreeBSD.org/src.git synced 2025-01-08 13:28:05 +00:00

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
This commit is contained in:
Alexander Motin 2013-10-11 17:00:09 +00:00
parent ce3be286f0
commit c1215c324a
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=256317

View File

@ -886,12 +886,12 @@ mode_list(struct cam_device *device, int page_control, int dbd,
timeout, data, sizeof(data)); timeout, data, sizeof(data));
mh = (struct scsi_mode_header_6 *)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. */ /* Iterate through the pages in the reply. */
while (len < mh->data_length) { while (len < mh->data_length) {
/* Locate the next mode page header. */ /* Locate the next mode page header. */
mph = (struct scsi_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; mph->page_code &= SMS_PAGE_CODE;
nameentry = nameentry_lookup(mph->page_code); nameentry = nameentry_lookup(mph->page_code);