diff --git a/sys/kern/kern_shutdown.c b/sys/kern/kern_shutdown.c index d971ba4ebe27..91f45ab99c89 100644 --- a/sys/kern/kern_shutdown.c +++ b/sys/kern/kern_shutdown.c @@ -50,6 +50,7 @@ #include #include #include +#include #include #include #include @@ -429,8 +430,8 @@ setdumpdev(dev_t dev) /* * XXX should clean up checking in dumpsys() to be more like this. */ - newdumplo = psize - Maxmem * PAGE_SIZE / DEV_BSIZE; - if (newdumplo < 0) + newdumplo = psize - Maxmem * (PAGE_SIZE / DEV_BSIZE); + if (newdumplo <= LABELSECTOR) return (ENOSPC); dumpdev = dev; dumplo = newdumplo; diff --git a/sys/kern/subr_disk.c b/sys/kern/subr_disk.c index 2553bbcc2e18..da961bab3e6e 100644 --- a/sys/kern/subr_disk.c +++ b/sys/kern/subr_disk.c @@ -154,8 +154,8 @@ disk_dumpcheck(dev_t dev, u_int *count, u_int *blkno, u_int *secsize) dl = dsgetlabel(dev, dp->d_slice); if (!dl) return (ENXIO); - *count = (u_long)Maxmem * PAGE_SIZE / dl->d_secsize; - if (dumplo < 0 || + *count = Maxmem * (PAGE_SIZE / dl->d_secsize); + if (dumplo <= LABELSECTOR || (dumplo + *count > dl->d_partitions[dkpart(dev)].p_size)) return (EINVAL); boff = dl->d_partitions[dkpart(dev)].p_offset +