From 0bfd0c9eeee1887c39a87a77e1a487056fb215f8 Mon Sep 17 00:00:00 2001 From: Kenneth R Westerback Date: Thu, 17 Aug 2006 10:34:15 +0000 Subject: 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@ --- sys/arch/alpha/alpha/disksubr.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'sys/arch/alpha') 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; -- cgit v1.2.3