summaryrefslogtreecommitdiffstats
path: root/sys/amd64
diff options
context:
space:
mode:
Diffstat (limited to 'sys/amd64')
-rw-r--r--sys/amd64/amd64/dump_machdep.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/sys/amd64/amd64/dump_machdep.c b/sys/amd64/amd64/dump_machdep.c
index caa5883..7d1e06f 100644
--- a/sys/amd64/amd64/dump_machdep.c
+++ b/sys/amd64/amd64/dump_machdep.c
@@ -75,6 +75,15 @@ dumpsys(struct dumperinfo *di)
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);
OpenPOWER on IntegriCloud