diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 1998-11-21 20:43:45 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 1998-11-21 20:43:45 +0000 |
commit | 4bbe5420d3817e31d674e3475965ed3551363f72 (patch) | |
tree | dc349b52c646825153a642d519b8d6e7dbba21b6 | |
parent | 8bfce71941c8187b51777a022add42aac4668624 (diff) |
deal with d_secpercyl insanity
-rw-r--r-- | sys/arch/alpha/alpha/disksubr.c | 6 | ||||
-rw-r--r-- | sys/arch/i386/i386/disksubr.c | 6 | ||||
-rw-r--r-- | sys/arch/mips/mips/disksubr.c | 6 |
3 files changed, 15 insertions, 3 deletions
diff --git a/sys/arch/alpha/alpha/disksubr.c b/sys/arch/alpha/alpha/disksubr.c index 2031a7b70c3..d3aad8078e2 100644 --- a/sys/arch/alpha/alpha/disksubr.c +++ b/sys/arch/alpha/alpha/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.23 1998/10/03 21:18:54 millert Exp $ */ +/* $OpenBSD: disksubr.c,v 1.24 1998/11/21 20:43:42 deraadt Exp $ */ /* $NetBSD: disksubr.c,v 1.21 1996/05/03 19:42:03 christos Exp $ */ /* @@ -246,6 +246,10 @@ readdisklabel(dev, strat, lp, osdep, spoofonly) lp->d_secsize = DEV_BSIZE; if (lp->d_secperunit == 0) lp->d_secperunit = 0x1fffffff; + if (lp->d_secpercyl == 0) { + msg = "invalid geometry"; + goto done; + } lp->d_npartitions = RAW_PART + 1; for (i = 0; i < RAW_PART; i++) { lp->d_partitions[i].p_size = 0; diff --git a/sys/arch/i386/i386/disksubr.c b/sys/arch/i386/i386/disksubr.c index 128dead0b9c..7d99c2193f1 100644 --- a/sys/arch/i386/i386/disksubr.c +++ b/sys/arch/i386/i386/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.34 1998/10/03 21:18:54 millert Exp $ */ +/* $OpenBSD: disksubr.c,v 1.35 1998/11/21 20:43:43 deraadt Exp $ */ /* $NetBSD: disksubr.c,v 1.21 1996/05/03 19:42:03 christos Exp $ */ /* @@ -91,6 +91,10 @@ readdisklabel(dev, strat, lp, osdep, spoofonly) /* minimal requirements for archtypal disk label */ if (lp->d_secsize == 0) lp->d_secsize = DEV_BSIZE; + if (lp->d_secpercyl == 0) { + msg = "invalid geometry"; + goto done; + } if (lp->d_secperunit == 0) lp->d_secperunit = 0x1fffffff; lp->d_npartitions = RAW_PART + 1; diff --git a/sys/arch/mips/mips/disksubr.c b/sys/arch/mips/mips/disksubr.c index a3a748829ce..36aee7976bc 100644 --- a/sys/arch/mips/mips/disksubr.c +++ b/sys/arch/mips/mips/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.6 1998/10/03 21:18:55 millert Exp $ */ +/* $OpenBSD: disksubr.c,v 1.7 1998/11/21 20:43:44 deraadt Exp $ */ /* $NetBSD: disksubr.c,v 1.21 1996/05/03 19:42:03 christos Exp $ */ /* @@ -96,6 +96,10 @@ readdisklabel(dev, strat, lp, osdep, spoofonly) lp->d_secsize = DEV_BSIZE; if (lp->d_secperunit == 0) lp->d_secperunit = 0x1fffffff; + if (lp->d_secpercyl == 0) { + msg = "invalid geometry"; + goto done; + } lp->d_npartitions = RAW_PART + 1; for (i = 0; i < RAW_PART; i++) { lp->d_partitions[i].p_size = 0; |