summaryrefslogtreecommitdiff
path: root/sys/arch/sparc64
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2007-06-06 22:14:33 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2007-06-06 22:14:33 +0000
commit848c41bdfbd7fce5fd07bdaf8ac5e7ba5ac60aee (patch)
treeb573977d7e07266977ccb7241ea66a343cc63c9f /sys/arch/sparc64
parentaec7c452bd9ea15493327c9356a66a1ba19cc99c (diff)
clamp the disklabel d_secperunit to what the disk actually says it has,
not to what some bogus disklabel from the past may say (some of which may have been caused by older openbsd disklabel programs). resolves issues seen by myself and Markus Lude on sparc/sparc64 machines
Diffstat (limited to 'sys/arch/sparc64')
-rw-r--r--sys/arch/sparc64/sparc64/disksubr.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/sys/arch/sparc64/sparc64/disksubr.c b/sys/arch/sparc64/sparc64/disksubr.c
index bffd4adbc90..c12b448aa80 100644
--- a/sys/arch/sparc64/sparc64/disksubr.c
+++ b/sys/arch/sparc64/sparc64/disksubr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: disksubr.c,v 1.30 2007/06/06 16:42:06 deraadt Exp $ */
+/* $OpenBSD: disksubr.c,v 1.31 2007/06/06 22:14:32 deraadt Exp $ */
/* $NetBSD: disksubr.c,v 1.13 2000/12/17 22:39:18 pk Exp $ */
/*
@@ -401,7 +401,8 @@ disklabel_sun_to_bsd(char *cp, struct disklabel *lp)
secpercyl = sl->sl_nsectors * sl->sl_ntracks;
lp->d_secpercyl = secpercyl;
- DL_SETDSIZE(lp, (daddr64_t)secpercyl * sl->sl_ncylinders);
+ if (DL_GETDSIZE(lp) == 0)
+ DL_SETDSIZE(lp, (daddr64_t)secpercyl * sl->sl_ncylinders);
lp->d_version = 1; /* 48 bit addressing */
lp->d_sparespercyl = sl->sl_sparespercyl;