summaryrefslogtreecommitdiff
path: root/sys/scsi/scsiconf.c
diff options
context:
space:
mode:
authorDavid Gwynne <dlg@cvs.openbsd.org>2010-09-02 11:54:45 +0000
committerDavid Gwynne <dlg@cvs.openbsd.org>2010-09-02 11:54:45 +0000
commit55ef988100b3ab3caee5503da68d6de24d7ee4cd (patch)
tree494d7185dd7dd15aceeb18d0a3269011f887640b /sys/scsi/scsiconf.c
parent3f6565d47e14274b3609bf60d2aa3d644861b1df (diff)
the page_length field in the vpd page header is 2 bytes, not 1.
ok krw@ marco@ matthew@
Diffstat (limited to 'sys/scsi/scsiconf.c')
-rw-r--r--sys/scsi/scsiconf.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/sys/scsi/scsiconf.c b/sys/scsi/scsiconf.c
index c96b94abb4f..f4abf5d8028 100644
--- a/sys/scsi/scsiconf.c
+++ b/sys/scsi/scsiconf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: scsiconf.c,v 1.164 2010/08/31 17:13:48 deraadt Exp $ */
+/* $OpenBSD: scsiconf.c,v 1.165 2010/09/02 11:54:44 dlg Exp $ */
/* $NetBSD: scsiconf.c,v 1.57 1996/05/02 01:09:01 neil Exp $ */
/*
@@ -1124,6 +1124,7 @@ scsi_devid(struct scsi_link *link)
u_int8_t list[32];
} __packed pg;
int pg80 = 0, pg83 = 0, i;
+ size_t len;
if (link->id != NULL)
return;
@@ -1133,7 +1134,8 @@ scsi_devid(struct scsi_link *link)
scsi_autoconf) != 0)
return;
- for (i = 0; i < MIN(sizeof(pg.list), pg.hdr.page_length); i++) {
+ len = MIN(sizeof(pg.list), _2btol(pg.hdr.page_length));
+ for (i = 0; i < len; i++) {
switch (pg.list[i]) {
case SI_PG_SERIAL:
pg80 = 1;
@@ -1169,7 +1171,7 @@ scsi_devid_pg83(struct scsi_link *link)
if (rv != 0)
return (rv);
- len = sizeof(hdr) + hdr.page_length;
+ len = sizeof(hdr) + _2btol(hdr.page_length);
pg = malloc(len, M_TEMP, M_WAITOK);
rv = scsi_inquire_vpd(link, pg, len, SI_PG_DEVID, scsi_autoconf);