summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortholo <tholo@openbsd.org>1997-06-14 06:10:36 +0000
committertholo <tholo@openbsd.org>1997-06-14 06:10:36 +0000
commitb9f9901bd1a229b45e957261665cf1f0d5db67bc (patch)
treeeed9ba99c558f32d56975b0e0dd09cc23fd79a11
parentTCP/IP Illustrated Vol. 2, pg 1010. excessive testing in PRU_DETACH case; (diff)
downloadwireguard-openbsd-b9f9901bd1a229b45e957261665cf1f0d5db67bc.tar.xz
wireguard-openbsd-b9f9901bd1a229b45e957261665cf1f0d5db67bc.zip
Don't look beyond the end of bdevsw[], from NetBSD PR 3748 by Michael L Hitch
-rw-r--r--sys/kern/vfs_bio.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/sys/kern/vfs_bio.c b/sys/kern/vfs_bio.c
index ffa423f0c88..d1d4592820c 100644
--- a/sys/kern/vfs_bio.c
+++ b/sys/kern/vfs_bio.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vfs_bio.c,v 1.14 1997/04/14 04:23:23 tholo Exp $ */
+/* $OpenBSD: vfs_bio.c,v 1.15 1997/06/14 06:10:36 tholo Exp $ */
/* $NetBSD: vfs_bio.c,v 1.44 1996/06/11 11:15:36 pk Exp $ */
/*-
@@ -402,7 +402,8 @@ bdwrite(bp)
}
/* If this is a tape block, write the block now. */
- if (bdevsw[major(bp->b_dev)].d_type == D_TAPE) {
+ if (major(bp->b_dev) < nblkdev &&
+ bdevsw[major(bp->b_dev)].d_type == D_TAPE) {
bawrite(bp);
return;
}