summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1996-12-06 15:59:21 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1996-12-06 15:59:21 +0000
commit35a9069105060d0cce2fccdc0af4ba94f4d3e260 (patch)
treed911b14f47039b268c90a48cdabbc87f83d5073e
parent85835d2fd9d85457892a067f1d54ac9270d5ae71 (diff)
sizeof(x)/sizeof(x[0]) is your friend
-rw-r--r--sys/arch/i386/i386/autoconf.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/sys/arch/i386/i386/autoconf.c b/sys/arch/i386/i386/autoconf.c
index 30e794ebf03..ffe2374b3dd 100644
--- a/sys/arch/i386/i386/autoconf.c
+++ b/sys/arch/i386/i386/autoconf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: autoconf.c,v 1.22 1996/12/05 14:27:50 deraadt Exp $ */
+/* $OpenBSD: autoconf.c,v 1.23 1996/12/06 15:59:20 deraadt Exp $ */
/* $NetBSD: autoconf.c,v 1.20 1996/05/03 19:41:56 christos Exp $ */
/*-
@@ -177,7 +177,8 @@ setroot()
(bootdev & B_MAGICMASK) != (u_long)B_DEVMAGIC)
return;
majdev = (bootdev >> B_TYPESHIFT) & B_TYPEMASK;
- if ((majdev > 20) || (*devname[majdev] == '\0'))
+ if (majdev > sizeof(devname)/sizeof(devname[0]) ||
+ *devname[majdev] == '\0')
return;
adaptor = (bootdev >> B_ADAPTORSHIFT) & B_ADAPTORMASK;
part = (bootdev >> B_PARTITIONSHIFT) & B_PARTITIONMASK;
@@ -196,8 +197,7 @@ setroot()
#ifdef DOSWAP
for (swp = swdevt; swp->sw_dev != NODEV; swp++) {
if (majdev == major(swp->sw_dev) &&
- (mindev / MAXPARTITIONS) ==
- (minor(swp->sw_dev) / MAXPARTITIONS)) {
+ mindev/MAXPARTITIONS == minor(swp->sw_dev)/MAXPARTITIONS) {
temp = swdevt[0].sw_dev;
swdevt[0].sw_dev = swp->sw_dev;
swp->sw_dev = temp;