summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornyan <nyan@FreeBSD.org>1999-10-27 12:40:20 +0000
committernyan <nyan@FreeBSD.org>1999-10-27 12:40:20 +0000
commit834ffc78b684c4dc6d2510d0af54752117565c4b (patch)
tree731f27038d7b4ab79de8047b9c7d6ff4fd2e4a68
parenta7375e191d9fcccb21870288f0ecfc0e75531fa7 (diff)
downloadFreeBSD-src-834ffc78b684c4dc6d2510d0af54752117565c4b.zip
FreeBSD-src-834ffc78b684c4dc6d2510d0af54752117565c4b.tar.gz
Fix potential panic by illegal increment of wfdnlun.
Submitted by: chi@bd.mbn.or.jp (Chiharu Shibata) Reviewed by: Junichi Satoh <junichi@astec.co.jp> (the original author)
-rw-r--r--sys/i386/isa/wfd.c5
-rw-r--r--sys/pc98/pc98/wfd.c5
2 files changed, 6 insertions, 4 deletions
diff --git a/sys/i386/isa/wfd.c b/sys/i386/isa/wfd.c
index 4a19d79..045d1d8 100644
--- a/sys/i386/isa/wfd.c
+++ b/sys/i386/isa/wfd.c
@@ -192,7 +192,7 @@ wfdattach (struct atapi *ata, int unit, struct atapi_params *ap, int debug)
bufq_init(&t->buf_queue);
t->ata = ata;
t->unit = unit;
- lun = t->lun = wfdnlun++;
+ lun = t->lun = wfdnlun;
t->param = ap;
t->flags = F_MEDIA_CHANGED;
t->refcnt = 0;
@@ -251,10 +251,11 @@ wfdattach (struct atapi *ata, int unit, struct atapi_params *ap, int debug)
* Export the drive to the devstat interface.
*/
devstat_add_entry(&t->device_stats, "wfd",
- wfdnlun, t->cap.sector_size,
+ t->lun, t->cap.sector_size,
DEVSTAT_NO_ORDERED_TAGS,
DEVSTAT_TYPE_FLOPPY | DEVSTAT_TYPE_IF_IDE,
DEVSTAT_PRIORITY_WFD);
+ wfdnlun++;
return (1);
}
diff --git a/sys/pc98/pc98/wfd.c b/sys/pc98/pc98/wfd.c
index 4a19d79..045d1d8 100644
--- a/sys/pc98/pc98/wfd.c
+++ b/sys/pc98/pc98/wfd.c
@@ -192,7 +192,7 @@ wfdattach (struct atapi *ata, int unit, struct atapi_params *ap, int debug)
bufq_init(&t->buf_queue);
t->ata = ata;
t->unit = unit;
- lun = t->lun = wfdnlun++;
+ lun = t->lun = wfdnlun;
t->param = ap;
t->flags = F_MEDIA_CHANGED;
t->refcnt = 0;
@@ -251,10 +251,11 @@ wfdattach (struct atapi *ata, int unit, struct atapi_params *ap, int debug)
* Export the drive to the devstat interface.
*/
devstat_add_entry(&t->device_stats, "wfd",
- wfdnlun, t->cap.sector_size,
+ t->lun, t->cap.sector_size,
DEVSTAT_NO_ORDERED_TAGS,
DEVSTAT_TYPE_FLOPPY | DEVSTAT_TYPE_IF_IDE,
DEVSTAT_PRIORITY_WFD);
+ wfdnlun++;
return (1);
}
OpenPOWER on IntegriCloud