summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2020-12-07 20:03:26 +0100
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2020-12-07 20:03:42 +0100
commit3c0b306d01a95e17579d938d8e9e8c527c251a4a (patch)
tree03af6bca9df37218644812a6840689892f078c11
parent6610a5a28b2140ea932a8247733a90a0675660b6 (diff)
i386at: Really disable com and lpr above NCOM and NLPR
commmodem and lprinfo arrays would otherwise overflow. * i386/i386at/com.c (comattach): Return early when unit is beyond NCOM. * i386/i386at/lpr.c (lprattach): Return early when unit is beyond NLPR.
-rw-r--r--i386/i386at/com.c5
-rw-r--r--i386/i386at/lpr.c5
2 files changed, 10 insertions, 0 deletions
diff --git a/i386/i386at/com.c b/i386/i386at/com.c
index 2bdbc0d0..02b650b8 100644
--- a/i386/i386at/com.c
+++ b/i386/i386at/com.c
@@ -224,6 +224,11 @@ comattach(struct bus_device *dev)
u_char unit = dev->unit;
u_short addr = dev->address;
+ if (unit >= NCOM) {
+ printf(", disabled by NCOM configuration\n");
+ return;
+ }
+
take_dev_irq(dev);
printf(", port = %lx, spl = %ld, pic = %d. (DOS COM%d)",
dev->address, dev->sysdep, dev->sysdep1, unit+1);
diff --git a/i386/i386at/lpr.c b/i386/i386at/lpr.c
index 49cb1387..fe088771 100644
--- a/i386/i386at/lpr.c
+++ b/i386/i386at/lpr.c
@@ -94,6 +94,11 @@ void lprattach(struct bus_device *dev)
u_char unit = dev->unit;
u_short addr = (u_short) dev->address;
+ if (unit >= NLPR) {
+ printf(", disabled by NLPR configuration\n");
+ return;
+ }
+
take_dev_irq(dev);
printf(", port = %lx, spl = %ld, pic = %d.",
dev->address, dev->sysdep, dev->sysdep1);