summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorConstantine Sapuntzakis <csapuntz@cvs.openbsd.org>1999-07-17 17:00:27 +0000
committerConstantine Sapuntzakis <csapuntz@cvs.openbsd.org>1999-07-17 17:00:27 +0000
commitdcf81d29918ea41178b33d4438afefe20874a748 (patch)
treefb5436f65f27180359963f72e0ace151ece3a676 /sys
parent9a4e4eaa50c842768e5f19d00f5900da809c59e0 (diff)
Fix a bug that caused panic instead of error return with invalid disk
geometries. Make sure we don't brelse a buf that we don't have.
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/i386/i386/disksubr.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/sys/arch/i386/i386/disksubr.c b/sys/arch/i386/i386/disksubr.c
index a3ae93c54d0..ecfb1aa1dc0 100644
--- a/sys/arch/i386/i386/disksubr.c
+++ b/sys/arch/i386/i386/disksubr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: disksubr.c,v 1.36 1999/01/08 04:29:06 millert Exp $ */
+/* $OpenBSD: disksubr.c,v 1.37 1999/07/17 17:00:26 csapuntz Exp $ */
/* $NetBSD: disksubr.c,v 1.21 1996/05/03 19:42:03 christos Exp $ */
/*
@@ -83,7 +83,7 @@ readdisklabel(dev, strat, lp, osdep, spoofonly)
{
struct dos_partition *dp = osdep->dosparts, *dp2;
struct dkbad *bdp = &DKBAD(osdep);
- struct buf *bp;
+ struct buf *bp = NULL;
struct disklabel *dlp;
char *msg = NULL, *cp;
int dospartoff, cyl, i, ourpart = -1;
@@ -323,8 +323,10 @@ donot:
}
done:
- bp->b_flags |= B_INVAL;
- brelse(bp);
+ if (bp) {
+ bp->b_flags |= B_INVAL;
+ brelse(bp);
+ }
return (msg);
}