From owner-cvs-all Mon Dec 16 16: 9:31 2002 Delivered-To: cvs-all@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id CB2CA37B401; Mon, 16 Dec 2002 16:09:29 -0800 (PST) Received: from apollo.backplane.com (apollo.backplane.com [216.240.41.2]) by mx1.FreeBSD.org (Postfix) with ESMTP id 738B543ED4; Mon, 16 Dec 2002 16:09:29 -0800 (PST) (envelope-from dillon@apollo.backplane.com) Received: from apollo.backplane.com (localhost [127.0.0.1]) by apollo.backplane.com (8.12.5/8.12.5) with ESMTP id gBH09TOM082088; Mon, 16 Dec 2002 16:09:29 -0800 (PST) (envelope-from dillon@apollo.backplane.com) Received: (from dillon@localhost) by apollo.backplane.com (8.12.5/8.12.5/Submit) id gBH09TFn082087; Mon, 16 Dec 2002 16:09:29 -0800 (PST) (envelope-from dillon) Date: Mon, 16 Dec 2002 16:09:29 -0800 (PST) From: Matthew Dillon Message-Id: <200212170009.gBH09TFn082087@apollo.backplane.com> To: Nate Lawson Cc: Julian Elischer , cvs-all@FreeBSD.ORG, cvs-committers@FreeBSD.ORG Subject: Re: cvs commit: src/sys/i386/i386 dump_machdep.c References: Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Hmm. Wouldn't this be easier if the test were done after calculating dumplo? e.g. :> dumplo = di->mediaoffset + di->mediasize - Maxmem * (off_t)PAGE_SIZE; :> dumplo -= sizeof kdh * 2; /* * Make sure the media is big enough, and that we do not * overwrite potential label data. */ if (dumplo - 64 * 1024 < di->mediaoffset) { ... } -Matt Matthew Dillon :> Don't dump core into a partition that is too small for it. :> If we do, we usually wrote backwareds into the proceeding partititon :> which is usually the root partition. :> [..] :> @@ -75,6 +75,15 @@ :> strncpy(kdh.panicstring, panicstr, sizeof kdh.panicstring); :> kdh.parity = kerneldump_parity(&kdh); :> :> + if (di->mediasize < :> + ((Maxmem * (off_t)PAGE_SIZE) + /* Memory to save */ :> + (sizeof kdh * 2) + /* header + trailer */ :> + (64*1024))) { /* Room to leave untouched */ :> + /* at partition head. */ :> + /* (an arbitrary amount). */ :> + printf("\nDump failed. Partition too small.\n"); :> + return; :> + } :> dumplo = di->mediaoffset + di->mediasize - Maxmem * (off_t)PAGE_SIZE; :> dumplo -= sizeof kdh * 2; :> i = di->dumper(di->priv, &kdh, 0, dumplo, sizeof kdh); : :Heh, it seems you went even farther to tweak everyone that had style(9) :complaints with the proposal. At the very least, PLEASE move the comment :to before the line. : :Functionally, it is important that this check be MI. : :-Nate To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message