diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2004-03-17 14:16:05 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2004-03-17 14:16:05 +0000 |
commit | c0b177fe05a7f10e70abcee079533145eb5dba77 (patch) | |
tree | 5024a4b2ec5e40cfa4d78ab902ed2c2a862cfb12 | |
parent | e3f80c61b9b14ab0c39013d4206080bf56751949 (diff) |
Make sure disklabels use at least DEV_BSIZE as their sector size.
This allows the kernel to survive reading the disklabel off a 256-bytes/sector
scsi device...
ok deraadt@
-rw-r--r-- | sys/arch/alpha/alpha/disksubr.c | 4 | ||||
-rw-r--r-- | sys/arch/amd64/amd64/disksubr.c | 4 | ||||
-rw-r--r-- | sys/arch/arm/arm/disksubr.c | 4 | ||||
-rw-r--r-- | sys/arch/hp300/hp300/disksubr.c | 4 | ||||
-rw-r--r-- | sys/arch/hppa/hppa/disksubr.c | 4 | ||||
-rw-r--r-- | sys/arch/i386/i386/disksubr.c | 4 | ||||
-rw-r--r-- | sys/arch/mac68k/mac68k/disksubr.c | 4 | ||||
-rw-r--r-- | sys/arch/macppc/macppc/disksubr.c | 4 | ||||
-rw-r--r-- | sys/arch/mvme68k/mvme68k/disksubr.c | 4 | ||||
-rw-r--r-- | sys/arch/mvme88k/mvme88k/disksubr.c | 4 | ||||
-rw-r--r-- | sys/arch/mvmeppc/mvmeppc/disksubr.c | 4 | ||||
-rw-r--r-- | sys/arch/pegasos/pegasos/disksubr.c | 4 | ||||
-rw-r--r-- | sys/arch/sparc/sparc/disksubr.c | 4 | ||||
-rw-r--r-- | sys/arch/sparc64/sparc64/disksubr.c | 4 | ||||
-rw-r--r-- | sys/arch/vax/vax/disksubr.c | 4 |
15 files changed, 33 insertions, 27 deletions
diff --git a/sys/arch/alpha/alpha/disksubr.c b/sys/arch/alpha/alpha/disksubr.c index b8439b4e5fc..060fe419756 100644 --- a/sys/arch/alpha/alpha/disksubr.c +++ b/sys/arch/alpha/alpha/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.38 2003/10/18 20:14:40 jmc Exp $ */ +/* $OpenBSD: disksubr.c,v 1.39 2004/03/17 14:16:00 miod Exp $ */ /* $NetBSD: disksubr.c,v 1.21 1996/05/03 19:42:03 christos Exp $ */ /* @@ -236,7 +236,7 @@ readdisklabel(dev, strat, lp, osdep, spoofonly) struct disklabel minilabel, fallbacklabel; /* minimal requirements for archetypal disk label */ - if (lp->d_secsize == 0) + if (lp->d_secsize < DEV_BSIZE) lp->d_secsize = DEV_BSIZE; if (lp->d_secperunit == 0) lp->d_secperunit = 0x1fffffff; diff --git a/sys/arch/amd64/amd64/disksubr.c b/sys/arch/amd64/amd64/disksubr.c index c44f592be57..209caa3d5a4 100644 --- a/sys/arch/amd64/amd64/disksubr.c +++ b/sys/arch/amd64/amd64/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.1 2004/01/28 01:39:38 mickey Exp $ */ +/* $OpenBSD: disksubr.c,v 1.2 2004/03/17 14:16:03 miod Exp $ */ /* $NetBSD: disksubr.c,v 1.21 1996/05/03 19:42:03 christos Exp $ */ /* @@ -87,7 +87,7 @@ readdisklabel(dev, strat, lp, osdep, spoofonly) int dospartoff, cyl, i, ourpart = -1; /* minimal requirements for archtypal disk label */ - if (lp->d_secsize == 0) + if (lp->d_secsize < DEV_BSIZE) lp->d_secsize = DEV_BSIZE; if (lp->d_secpercyl == 0) { msg = "invalid geometry"; diff --git a/sys/arch/arm/arm/disksubr.c b/sys/arch/arm/arm/disksubr.c index 7eeca7e5921..389590526fc 100644 --- a/sys/arch/arm/arm/disksubr.c +++ b/sys/arch/arm/arm/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.2 2004/02/23 05:07:54 drahn Exp $ */ +/* $OpenBSD: disksubr.c,v 1.3 2004/03/17 14:16:03 miod Exp $ */ /* $NetBSD: disksubr.c,v 1.21 1996/05/03 19:42:03 christos Exp $ */ /* @@ -82,7 +82,7 @@ readdisklabel(dev, strat, lp, osdep, spoofonly) int dospartoff, cyl, i, ourpart = -1; /* minimal requirements for archtypal disk label */ - if (lp->d_secsize == 0) + if (lp->d_secsize < DEV_BSIZE) lp->d_secsize = DEV_BSIZE; if (lp->d_secpercyl == 0) { msg = "invalid geometry"; diff --git a/sys/arch/hp300/hp300/disksubr.c b/sys/arch/hp300/hp300/disksubr.c index a91cdbd87e1..79ffe8f401b 100644 --- a/sys/arch/hp300/hp300/disksubr.c +++ b/sys/arch/hp300/hp300/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.15 2003/06/02 23:27:45 millert Exp $ */ +/* $OpenBSD: disksubr.c,v 1.16 2004/03/17 14:16:04 miod Exp $ */ /* $NetBSD: disksubr.c,v 1.9 1997/04/01 03:12:13 scottr Exp $ */ /* @@ -73,7 +73,7 @@ readdisklabel(dev, strat, lp, osdep, spoofonly) char *msg = NULL; /* minimal requirements for archetypal disk label */ - if (lp->d_secsize == 0) + if (lp->d_secsize < DEV_BSIZE) lp->d_secsize = DEV_BSIZE; if (lp->d_secperunit == 0) lp->d_secperunit = 0x1fffffff; diff --git a/sys/arch/hppa/hppa/disksubr.c b/sys/arch/hppa/hppa/disksubr.c index 8386ae5caf1..86c8ad7614d 100644 --- a/sys/arch/hppa/hppa/disksubr.c +++ b/sys/arch/hppa/hppa/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.14 2003/10/27 17:20:15 mickey Exp $ */ +/* $OpenBSD: disksubr.c,v 1.15 2004/03/17 14:16:04 miod Exp $ */ /* * Copyright (c) 1999 Michael Shalayeff @@ -246,7 +246,7 @@ readdisklabel(dev, strat, lp, osdep, spoofonly) struct disklabel minilabel, fallbacklabel; /* minimal requirements for archtypal disk label */ - if (lp->d_secsize == 0) + if (lp->d_secsize < DEV_BSIZE) lp->d_secsize = DEV_BSIZE; if (lp->d_secperunit == 0) lp->d_secperunit = 0x1fffffff; diff --git a/sys/arch/i386/i386/disksubr.c b/sys/arch/i386/i386/disksubr.c index d2975db4d90..da9f77569a9 100644 --- a/sys/arch/i386/i386/disksubr.c +++ b/sys/arch/i386/i386/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.43 2003/06/02 23:27:47 millert Exp $ */ +/* $OpenBSD: disksubr.c,v 1.44 2004/03/17 14:16:04 miod 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) int dospartoff, cyl, i, ourpart = -1; /* minimal requirements for archtypal disk label */ - if (lp->d_secsize == 0) + if (lp->d_secsize < DEV_BSIZE) lp->d_secsize = DEV_BSIZE; if (lp->d_secpercyl == 0) { msg = "invalid geometry"; diff --git a/sys/arch/mac68k/mac68k/disksubr.c b/sys/arch/mac68k/mac68k/disksubr.c index f66a87ab783..bccc3cf1f5b 100644 --- a/sys/arch/mac68k/mac68k/disksubr.c +++ b/sys/arch/mac68k/mac68k/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.23 2003/06/02 23:27:49 millert Exp $ */ +/* $OpenBSD: disksubr.c,v 1.24 2004/03/17 14:16:04 miod Exp $ */ /* $NetBSD: disksubr.c,v 1.22 1997/11/26 04:18:20 briggs Exp $ */ /* @@ -365,7 +365,7 @@ readdisklabel(dev, strat, lp, osdep, spoofonly) int i, size; /* minimal requirements for archetypal disk label */ - if (lp->d_secsize == 0) + if (lp->d_secsize < DEV_BSIZE) lp->d_secsize = DEV_BSIZE; if (lp->d_secperunit == 0) lp->d_secperunit = 0x1fffffff; diff --git a/sys/arch/macppc/macppc/disksubr.c b/sys/arch/macppc/macppc/disksubr.c index 7ebc1e556f9..543bf37d141 100644 --- a/sys/arch/macppc/macppc/disksubr.c +++ b/sys/arch/macppc/macppc/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.9 2003/10/16 05:03:22 deraadt Exp $ */ +/* $OpenBSD: disksubr.c,v 1.10 2004/03/17 14:16:04 miod Exp $ */ /* $NetBSD: disksubr.c,v 1.21 1996/05/03 19:42:03 christos Exp $ */ /* @@ -87,7 +87,7 @@ readdisklabel(dev_t dev, void (*strat)(struct buf *), /* minimal requirements for archtypal disk label */ - if (lp->d_secsize == 0) + if (lp->d_secsize < DEV_BSIZE) lp->d_secsize = DEV_BSIZE; if (lp->d_secperunit == 0) lp->d_secperunit = 0x1fffffff; diff --git a/sys/arch/mvme68k/mvme68k/disksubr.c b/sys/arch/mvme68k/mvme68k/disksubr.c index 8ee46bfa2e6..770a0f828ac 100644 --- a/sys/arch/mvme68k/mvme68k/disksubr.c +++ b/sys/arch/mvme68k/mvme68k/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.29 2003/08/23 22:52:40 deraadt Exp $ */ +/* $OpenBSD: disksubr.c,v 1.30 2004/03/17 14:16:04 miod Exp $ */ /* * Copyright (c) 1998 Steve Murphree, Jr. * Copyright (c) 1995 Dale Rahn. @@ -119,7 +119,7 @@ readdisklabel(dev, strat, lp, clp, spoofonly) int error, i; /* minimal requirements for archetypal disk label */ - if (lp->d_secsize == 0) + if (lp->d_secsize < DEV_BSIZE) lp->d_secsize = DEV_BSIZE; if (lp->d_secperunit == 0) lp->d_secperunit = 0x1fffffff; diff --git a/sys/arch/mvme88k/mvme88k/disksubr.c b/sys/arch/mvme88k/mvme88k/disksubr.c index c0ed981dc5e..18c2ce788c5 100644 --- a/sys/arch/mvme88k/mvme88k/disksubr.c +++ b/sys/arch/mvme88k/mvme88k/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.24 2004/01/12 17:30:26 miod Exp $ */ +/* $OpenBSD: disksubr.c,v 1.25 2004/03/17 14:16:04 miod Exp $ */ /* * Copyright (c) 1998 Steve Murphree, Jr. * Copyright (c) 1995 Dale Rahn. @@ -137,7 +137,7 @@ readdisklabel(dev, strat, lp, clp, spoofonly) int error, i; /* minimal requirements for archetypal disk label */ - if (lp->d_secsize == 0) + if (lp->d_secsize < DEV_BSIZE) lp->d_secsize = DEV_BSIZE; if (lp->d_secperunit == 0) lp->d_secperunit = 0x1fffffff; diff --git a/sys/arch/mvmeppc/mvmeppc/disksubr.c b/sys/arch/mvmeppc/mvmeppc/disksubr.c index dca5aa5ff7a..0a1dc82426e 100644 --- a/sys/arch/mvmeppc/mvmeppc/disksubr.c +++ b/sys/arch/mvmeppc/mvmeppc/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.5 2003/06/02 23:27:53 millert Exp $ */ +/* $OpenBSD: disksubr.c,v 1.6 2004/03/17 14:16:04 miod Exp $ */ /* $NetBSD: disksubr.c,v 1.21 1996/05/03 19:42:03 christos Exp $ */ /* @@ -88,7 +88,7 @@ readdisklabel(dev, strat, lp, osdep, spoofonly) int dospartoff, cyl, i, ourpart = -1; /* minimal requirements for archtypal disk label */ - if (lp->d_secsize == 0) + if (lp->d_secsize < DEV_BSIZE) lp->d_secsize = DEV_BSIZE; if (lp->d_secperunit == 0) lp->d_secperunit = 0x1fffffff; diff --git a/sys/arch/pegasos/pegasos/disksubr.c b/sys/arch/pegasos/pegasos/disksubr.c index 27b4e1484c7..4802d37c1ef 100644 --- a/sys/arch/pegasos/pegasos/disksubr.c +++ b/sys/arch/pegasos/pegasos/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.2 2003/11/13 23:00:55 drahn Exp $ */ +/* $OpenBSD: disksubr.c,v 1.3 2004/03/17 14:16:04 miod Exp $ */ /* $NetBSD: disksubr.c,v 1.21 1996/05/03 19:42:03 christos Exp $ */ /* @@ -83,7 +83,7 @@ readdisklabel(dev_t dev, void (*strat)(struct buf *), int partoff, i, found; /* minimal requirements for archtypal disk label */ - if (lp->d_secsize == 0) + if (lp->d_secsize < DEV_BSIZE) lp->d_secsize = DEV_BSIZE; if (lp->d_secperunit == 0) lp->d_secperunit = 0x1fffffff; diff --git a/sys/arch/sparc/sparc/disksubr.c b/sys/arch/sparc/sparc/disksubr.c index 2878f8b6624..8bd369903df 100644 --- a/sys/arch/sparc/sparc/disksubr.c +++ b/sys/arch/sparc/sparc/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.29 2003/07/16 18:06:34 tedu Exp $ */ +/* $OpenBSD: disksubr.c,v 1.30 2004/03/17 14:16:04 miod Exp $ */ /* $NetBSD: disksubr.c,v 1.16 1996/04/28 20:25:59 thorpej Exp $ */ /* @@ -146,6 +146,8 @@ readdisklabel(dev, strat, lp, clp, spoofonly) int error, i; /* minimal requirements for archetypal disk label */ + if (lp->d_secsize < DEV_BSIZE) + lp->d_secsize = DEV_BSIZE; if (lp->d_secperunit == 0) lp->d_secperunit = 0x1fffffff; lp->d_npartitions = RAW_PART+1; diff --git a/sys/arch/sparc64/sparc64/disksubr.c b/sys/arch/sparc64/sparc64/disksubr.c index 11f4bb1ecd9..cbb3f0f7769 100644 --- a/sys/arch/sparc64/sparc64/disksubr.c +++ b/sys/arch/sparc64/sparc64/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.11 2003/07/16 18:06:35 tedu Exp $ */ +/* $OpenBSD: disksubr.c,v 1.12 2004/03/17 14:16:04 miod Exp $ */ /* $NetBSD: disksubr.c,v 1.13 2000/12/17 22:39:18 pk Exp $ */ /* @@ -91,6 +91,8 @@ readdisklabel(dev, strat, lp, clp, spoofonly) int error, i; /* minimal requirements for archtypal disk label */ + if (lp->d_secsize < DEV_BSIZE) + lp->d_secsize = DEV_BSIZE; if (lp->d_secperunit == 0) lp->d_secperunit = 0x1fffffff; lp->d_npartitions = RAW_PART+1; diff --git a/sys/arch/vax/vax/disksubr.c b/sys/arch/vax/vax/disksubr.c index 590c7c900cd..70b77a8e790 100644 --- a/sys/arch/vax/vax/disksubr.c +++ b/sys/arch/vax/vax/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.21 2003/11/10 21:05:06 miod Exp $ */ +/* $OpenBSD: disksubr.c,v 1.22 2004/03/17 14:16:04 miod Exp $ */ /* $NetBSD: disksubr.c,v 1.21 1999/06/30 18:48:06 ragge Exp $ */ /* @@ -128,6 +128,8 @@ readdisklabel(dev, strat, lp, osdep, spoofonly) int i; /* minimal requirements for archetypal disk label */ + if (lp->d_secsize < DEV_BSIZE) + lp->d_secsize = DEV_BSIZE; if (lp->d_secperunit == 0) lp->d_secperunit = 0x1fffffff; lp->d_npartitions = RAW_PART + 1; |