summaryrefslogtreecommitdiff
path: root/sys/arch
diff options
context:
space:
mode:
authorKenneth R Westerback <krw@cvs.openbsd.org>2006-08-17 10:34:15 +0000
committerKenneth R Westerback <krw@cvs.openbsd.org>2006-08-17 10:34:15 +0000
commit0bfd0c9eeee1887c39a87a77e1a487056fb215f8 (patch)
tree34470413c18db602c641504f1d7108493b6bce27 /sys/arch
parentbcd9b3f43d803a9c3588c2d8944185e7c8f0a5ca (diff)
Check d_secpercyl in all readdisklable() functions, and have all of
them return 'invalid geometry' when d_secpercyl == 0. While there move the check to a consistant location (after the check of d_secperunit) and use a consistant idiom (i.e. some readdisklabel()'s have no 'done' label). prodded by thib@ after a bad macppc experience. ok deraadt@
Diffstat (limited to 'sys/arch')
-rw-r--r--sys/arch/alpha/alpha/disksubr.c8
-rw-r--r--sys/arch/amd64/amd64/disksubr.c8
-rw-r--r--sys/arch/arm/arm/disksubr.c8
-rw-r--r--sys/arch/aviion/aviion/disksubr.c8
-rw-r--r--sys/arch/hp300/hp300/disksubr.c4
-rw-r--r--sys/arch/hppa/hppa/disksubr.c8
-rw-r--r--sys/arch/hppa64/hppa64/disksubr.c8
-rw-r--r--sys/arch/i386/i386/disksubr.c8
-rw-r--r--sys/arch/luna88k/luna88k/disksubr.c4
-rw-r--r--sys/arch/mac68k/mac68k/disksubr.c4
-rw-r--r--sys/arch/macppc/macppc/disksubr.c4
-rw-r--r--sys/arch/mips64/mips64/disksubr.c8
-rw-r--r--sys/arch/mvme68k/mvme68k/disksubr.c4
-rw-r--r--sys/arch/mvme88k/mvme88k/disksubr.c4
-rw-r--r--sys/arch/mvmeppc/mvmeppc/disksubr.c4
-rw-r--r--sys/arch/sparc/sparc/disksubr.c4
-rw-r--r--sys/arch/sparc64/sparc64/disksubr.c4
-rw-r--r--sys/arch/vax/vax/disksubr.c4
18 files changed, 52 insertions, 52 deletions
diff --git a/sys/arch/alpha/alpha/disksubr.c b/sys/arch/alpha/alpha/disksubr.c
index c6ed8a35d89..af5fb66154f 100644
--- a/sys/arch/alpha/alpha/disksubr.c
+++ b/sys/arch/alpha/alpha/disksubr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: disksubr.c,v 1.49 2006/08/11 21:32:39 krw Exp $ */
+/* $OpenBSD: disksubr.c,v 1.50 2006/08/17 10:34:14 krw Exp $ */
/* $NetBSD: disksubr.c,v 1.21 1996/05/03 19:42:03 christos Exp $ */
/*
@@ -143,10 +143,8 @@ 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;
- }
+ if (lp->d_secpercyl == 0)
+ return ("invalid geometry");
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/amd64/amd64/disksubr.c b/sys/arch/amd64/amd64/disksubr.c
index f8d53f28a50..6a614a1073d 100644
--- a/sys/arch/amd64/amd64/disksubr.c
+++ b/sys/arch/amd64/amd64/disksubr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: disksubr.c,v 1.10 2006/08/11 21:32:39 krw Exp $ */
+/* $OpenBSD: disksubr.c,v 1.11 2006/08/17 10:34:14 krw Exp $ */
/* $NetBSD: disksubr.c,v 1.21 1996/05/03 19:42:03 christos Exp $ */
/*
@@ -78,10 +78,8 @@ readdisklabel(dev, strat, lp, osdep, spoofonly)
/* minimal requirements for archetypal disk label */
if (lp->d_secsize < DEV_BSIZE)
lp->d_secsize = DEV_BSIZE;
- if (lp->d_secpercyl == 0) {
- msg = "invalid geometry";
- goto done;
- }
+ if (lp->d_secpercyl == 0)
+ return ("invalid geometry");
if (lp->d_secperunit == 0)
lp->d_secperunit = 0x1fffffff;
lp->d_npartitions = RAW_PART + 1;
diff --git a/sys/arch/arm/arm/disksubr.c b/sys/arch/arm/arm/disksubr.c
index 7e83d9f5caa..adc93c3ef8d 100644
--- a/sys/arch/arm/arm/disksubr.c
+++ b/sys/arch/arm/arm/disksubr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: disksubr.c,v 1.10 2006/08/11 21:32:39 krw Exp $ */
+/* $OpenBSD: disksubr.c,v 1.11 2006/08/17 10:34:14 krw Exp $ */
/* $NetBSD: disksubr.c,v 1.21 1996/05/03 19:42:03 christos Exp $ */
/*
@@ -77,12 +77,10 @@ readdisklabel(dev, strat, lp, osdep, spoofonly)
/* minimal requirements for archetypal disk label */
if (lp->d_secsize < DEV_BSIZE)
lp->d_secsize = DEV_BSIZE;
- if (lp->d_secpercyl == 0) {
- msg = "invalid geometry";
- goto done;
- }
if (lp->d_secperunit == 0)
lp->d_secperunit = 0x1fffffff;
+ if (lp->d_secpercyl == 0)
+ return ("invalid geometry");
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/aviion/aviion/disksubr.c b/sys/arch/aviion/aviion/disksubr.c
index bd89d8d85db..26399e60bbc 100644
--- a/sys/arch/aviion/aviion/disksubr.c
+++ b/sys/arch/aviion/aviion/disksubr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: disksubr.c,v 1.3 2006/08/11 21:32:40 krw Exp $ */
+/* $OpenBSD: disksubr.c,v 1.4 2006/08/17 10:34:14 krw Exp $ */
/* $NetBSD: disksubr.c,v 1.21 1996/05/03 19:42:03 christos Exp $ */
/*
@@ -77,12 +77,10 @@ readdisklabel(dev, strat, lp, osdep, spoofonly)
/* minimal requirements for archetypal disk label */
if (lp->d_secsize < DEV_BSIZE)
lp->d_secsize = DEV_BSIZE;
- if (lp->d_secpercyl == 0) {
- msg = "invalid geometry";
- goto done;
- }
if (lp->d_secperunit == 0)
lp->d_secperunit = 0x1fffffff;
+ if (lp->d_secpercyl == 0)
+ return ("invalid geometry");
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/hp300/hp300/disksubr.c b/sys/arch/hp300/hp300/disksubr.c
index ac7ec652c63..0928c74ac90 100644
--- a/sys/arch/hp300/hp300/disksubr.c
+++ b/sys/arch/hp300/hp300/disksubr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: disksubr.c,v 1.19 2006/03/15 20:20:39 miod Exp $ */
+/* $OpenBSD: disksubr.c,v 1.20 2006/08/17 10:34:14 krw Exp $ */
/* $NetBSD: disksubr.c,v 1.9 1997/04/01 03:12:13 scottr Exp $ */
/*
@@ -69,7 +69,7 @@ readdisklabel(dev, strat, lp, osdep, spoofonly)
if (lp->d_secperunit == 0)
lp->d_secperunit = 0x1fffffff;
if (lp->d_secpercyl == 0)
- lp->d_secpercyl = 1;
+ return ("invalid geometry");
lp->d_npartitions = RAW_PART + 1;
if (lp->d_partitions[RAW_PART].p_size == 0)
lp->d_partitions[RAW_PART].p_size = lp->d_secperunit;
diff --git a/sys/arch/hppa/hppa/disksubr.c b/sys/arch/hppa/hppa/disksubr.c
index 6dc3e45c4e9..58aa7826948 100644
--- a/sys/arch/hppa/hppa/disksubr.c
+++ b/sys/arch/hppa/hppa/disksubr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: disksubr.c,v 1.29 2006/08/11 21:32:40 krw Exp $ */
+/* $OpenBSD: disksubr.c,v 1.30 2006/08/17 10:34:14 krw Exp $ */
/*
* Copyright (c) 1999 Michael Shalayeff
@@ -147,10 +147,8 @@ 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;
- }
+ if (lp->d_secpercyl == 0)
+ return ("invalid geometry");
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/hppa64/hppa64/disksubr.c b/sys/arch/hppa64/hppa64/disksubr.c
index f5ca8500280..5c5eac1a334 100644
--- a/sys/arch/hppa64/hppa64/disksubr.c
+++ b/sys/arch/hppa64/hppa64/disksubr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: disksubr.c,v 1.12 2006/08/11 21:32:40 krw Exp $ */
+/* $OpenBSD: disksubr.c,v 1.13 2006/08/17 10:34:14 krw Exp $ */
/*
* Copyright (c) 1999 Michael Shalayeff
@@ -147,10 +147,8 @@ 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;
- }
+ if (lp->d_secpercyl == 0)
+ return ("invalid geometry");
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 1f528da5cae..fe6fa1de26c 100644
--- a/sys/arch/i386/i386/disksubr.c
+++ b/sys/arch/i386/i386/disksubr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: disksubr.c,v 1.52 2006/08/11 21:32:40 krw Exp $ */
+/* $OpenBSD: disksubr.c,v 1.53 2006/08/17 10:34:14 krw Exp $ */
/* $NetBSD: disksubr.c,v 1.21 1996/05/03 19:42:03 christos Exp $ */
/*
@@ -78,12 +78,10 @@ readdisklabel(dev, strat, lp, osdep, spoofonly)
/* minimal requirements for archetypal disk label */
if (lp->d_secsize < DEV_BSIZE)
lp->d_secsize = DEV_BSIZE;
- if (lp->d_secpercyl == 0) {
- msg = "invalid geometry";
- goto done;
- }
if (lp->d_secperunit == 0)
lp->d_secperunit = 0x1fffffff;
+ if (lp->d_secpercyl == 0)
+ return ("invalid geometry");
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/luna88k/luna88k/disksubr.c b/sys/arch/luna88k/luna88k/disksubr.c
index 7b2ef73d847..117170bb613 100644
--- a/sys/arch/luna88k/luna88k/disksubr.c
+++ b/sys/arch/luna88k/luna88k/disksubr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: disksubr.c,v 1.8 2006/06/11 14:08:36 krw Exp $ */
+/* $OpenBSD: disksubr.c,v 1.9 2006/08/17 10:34:14 krw Exp $ */
/* $NetBSD: disksubr.c,v 1.12 2002/02/19 17:09:44 wiz Exp $ */
/*
@@ -130,6 +130,8 @@ readdisklabel(dev, strat, lp, clp, spoofonly)
lp->d_secsize = DEV_BSIZE;
if (lp->d_secperunit == 0)
lp->d_secperunit = 0x1fffffff;
+ if (lp->d_secpercyl == 0)
+ return ("invalid geometry");
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/mac68k/mac68k/disksubr.c b/sys/arch/mac68k/mac68k/disksubr.c
index 0299749af9d..3d9408dc6d9 100644
--- a/sys/arch/mac68k/mac68k/disksubr.c
+++ b/sys/arch/mac68k/mac68k/disksubr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: disksubr.c,v 1.29 2006/03/15 20:20:40 miod Exp $ */
+/* $OpenBSD: disksubr.c,v 1.30 2006/08/17 10:34:14 krw Exp $ */
/* $NetBSD: disksubr.c,v 1.22 1997/11/26 04:18:20 briggs Exp $ */
/*
@@ -375,7 +375,7 @@ readdisklabel(dev, strat, lp, osdep, spoofonly)
if (lp->d_secperunit == 0)
lp->d_secperunit = 0x1fffffff;
if (lp->d_secpercyl == 0)
- lp->d_secpercyl = 1;
+ return ("invalid geometry");
lp->d_npartitions = RAW_PART + 1;
for (i = 0; i < MAXPARTITIONS; i++) {
lp->d_partitions[i].p_size = 0;
diff --git a/sys/arch/macppc/macppc/disksubr.c b/sys/arch/macppc/macppc/disksubr.c
index c2c67c2a4f1..bd0040b570a 100644
--- a/sys/arch/macppc/macppc/disksubr.c
+++ b/sys/arch/macppc/macppc/disksubr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: disksubr.c,v 1.19 2006/08/11 21:32:40 krw Exp $ */
+/* $OpenBSD: disksubr.c,v 1.20 2006/08/17 10:34:14 krw Exp $ */
/* $NetBSD: disksubr.c,v 1.21 1996/05/03 19:42:03 christos Exp $ */
/*
@@ -84,6 +84,8 @@ readdisklabel(dev_t dev, void (*strat)(struct buf *),
lp->d_secsize = DEV_BSIZE;
if (lp->d_secperunit == 0)
lp->d_secperunit = 0x1fffffff;
+ if (lp->d_secpercyl == 0)
+ return ("invalid geometry");
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/mips64/mips64/disksubr.c b/sys/arch/mips64/mips64/disksubr.c
index 7b3139838d5..237fdada2c4 100644
--- a/sys/arch/mips64/mips64/disksubr.c
+++ b/sys/arch/mips64/mips64/disksubr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: disksubr.c,v 1.18 2006/08/11 21:32:40 krw Exp $ */
+/* $OpenBSD: disksubr.c,v 1.19 2006/08/17 10:34:14 krw Exp $ */
/*
* Copyright (c) 1999 Michael Shalayeff
@@ -148,10 +148,8 @@ 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;
- }
+ if (lp->d_secpercyl == 0)
+ return ("invalid geometry");
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/mvme68k/mvme68k/disksubr.c b/sys/arch/mvme68k/mvme68k/disksubr.c
index 4a12ae71cbf..3e80149675b 100644
--- a/sys/arch/mvme68k/mvme68k/disksubr.c
+++ b/sys/arch/mvme68k/mvme68k/disksubr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: disksubr.c,v 1.34 2006/03/15 20:20:40 miod Exp $ */
+/* $OpenBSD: disksubr.c,v 1.35 2006/08/17 10:34:14 krw Exp $ */
/*
* Copyright (c) 1998 Steve Murphree, Jr.
* Copyright (c) 1995 Dale Rahn.
@@ -73,6 +73,8 @@ readdisklabel(dev, strat, lp, clp, spoofonly)
lp->d_secsize = DEV_BSIZE;
if (lp->d_secperunit == 0)
lp->d_secperunit = 0x1fffffff;
+ if (lp->d_secpercyl == 0)
+ return ("invalid geometry");
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/mvme88k/mvme88k/disksubr.c b/sys/arch/mvme88k/mvme88k/disksubr.c
index 46f55bedb14..7569c5a1635 100644
--- a/sys/arch/mvme88k/mvme88k/disksubr.c
+++ b/sys/arch/mvme88k/mvme88k/disksubr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: disksubr.c,v 1.32 2006/03/15 20:20:40 miod Exp $ */
+/* $OpenBSD: disksubr.c,v 1.33 2006/08/17 10:34:14 krw Exp $ */
/*
* Copyright (c) 1998 Steve Murphree, Jr.
* Copyright (c) 1995 Dale Rahn.
@@ -71,6 +71,8 @@ readdisklabel(dev, strat, lp, clp, spoofonly)
lp->d_secsize = DEV_BSIZE;
if (lp->d_secperunit == 0)
lp->d_secperunit = 0x1fffffff;
+ if (lp->d_secpercyl == 0)
+ return ("invalid geometry");
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/mvmeppc/mvmeppc/disksubr.c b/sys/arch/mvmeppc/mvmeppc/disksubr.c
index 8e0489696dc..d416119212f 100644
--- a/sys/arch/mvmeppc/mvmeppc/disksubr.c
+++ b/sys/arch/mvmeppc/mvmeppc/disksubr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: disksubr.c,v 1.15 2006/08/11 21:32:40 krw Exp $ */
+/* $OpenBSD: disksubr.c,v 1.16 2006/08/17 10:34:14 krw Exp $ */
/* $NetBSD: disksubr.c,v 1.21 1996/05/03 19:42:03 christos Exp $ */
/*
@@ -83,6 +83,8 @@ 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)
+ return ("invalid geometry");
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/sparc/sparc/disksubr.c b/sys/arch/sparc/sparc/disksubr.c
index d1b6f1a20ed..27180362798 100644
--- a/sys/arch/sparc/sparc/disksubr.c
+++ b/sys/arch/sparc/sparc/disksubr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: disksubr.c,v 1.40 2006/08/11 21:32:40 krw Exp $ */
+/* $OpenBSD: disksubr.c,v 1.41 2006/08/17 10:34:14 krw Exp $ */
/* $NetBSD: disksubr.c,v 1.16 1996/04/28 20:25:59 thorpej Exp $ */
/*
@@ -88,6 +88,8 @@ readdisklabel(dev, strat, lp, clp, spoofonly)
lp->d_secsize = DEV_BSIZE;
if (lp->d_secperunit == 0)
lp->d_secperunit = 0x1fffffff;
+ if (lp->d_secpercyl == 0)
+ return ("invalid geometry");
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/sparc64/sparc64/disksubr.c b/sys/arch/sparc64/sparc64/disksubr.c
index 7ae7359562d..a25cd33196a 100644
--- a/sys/arch/sparc64/sparc64/disksubr.c
+++ b/sys/arch/sparc64/sparc64/disksubr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: disksubr.c,v 1.18 2006/08/11 21:32:40 krw Exp $ */
+/* $OpenBSD: disksubr.c,v 1.19 2006/08/17 10:34:14 krw Exp $ */
/* $NetBSD: disksubr.c,v 1.13 2000/12/17 22:39:18 pk Exp $ */
/*
@@ -89,6 +89,8 @@ readdisklabel(dev, strat, lp, clp, spoofonly)
lp->d_secsize = DEV_BSIZE;
if (lp->d_secperunit == 0)
lp->d_secperunit = 0x1fffffff;
+ if (lp->d_secpercyl == 0)
+ return ("invalid geometry");
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/vax/vax/disksubr.c b/sys/arch/vax/vax/disksubr.c
index 10ec3410132..04902f6f19a 100644
--- a/sys/arch/vax/vax/disksubr.c
+++ b/sys/arch/vax/vax/disksubr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: disksubr.c,v 1.29 2006/08/11 21:32:40 krw Exp $ */
+/* $OpenBSD: disksubr.c,v 1.30 2006/08/17 10:34:14 krw Exp $ */
/* $NetBSD: disksubr.c,v 1.21 1999/06/30 18:48:06 ragge Exp $ */
/*
@@ -132,6 +132,8 @@ 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)
+ return ("invalid geometry");
lp->d_npartitions = RAW_PART + 1;
for (i = 0; i < RAW_PART; i++) {
lp->d_partitions[i].p_size = 0;