summaryrefslogtreecommitdiffstats
path: root/sys/dev/md
diff options
context:
space:
mode:
authorpjd <pjd@FreeBSD.org>2004-05-18 07:30:04 +0000
committerpjd <pjd@FreeBSD.org>2004-05-18 07:30:04 +0000
commit6f95f8aca440a968bc717ad3c168c2d790ba4f09 (patch)
treef9bf42ebf8e73e9788c37eb9a4f894b8151c1dac /sys/dev/md
parent4e45410d6eeccf593632df9186662ccb36c4ea8a (diff)
downloadFreeBSD-src-6f95f8aca440a968bc717ad3c168c2d790ba4f09.zip
FreeBSD-src-6f95f8aca440a968bc717ad3c168c2d790ba4f09.tar.gz
Fix panic which occurs when given sector size for memory-backed device
is less than DEV_BSIZE (512) bytes. Reported by: Mike Bristow <mike@urgle.com> Approved by: phk
Diffstat (limited to 'sys/dev/md')
-rw-r--r--sys/dev/md/md.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/sys/dev/md/md.c b/sys/dev/md/md.c
index 3183a77..4b680d7 100644
--- a/sys/dev/md/md.c
+++ b/sys/dev/md/md.c
@@ -805,8 +805,7 @@ mdcreate_malloc(struct md_ioctl *mdio)
sc->fwsectors = mdio->md_fwsectors;
if (mdio->md_fwheads != 0)
sc->fwheads = mdio->md_fwheads;
- sc->nsect = mdio->md_size;
- sc->nsect /= (sc->secsize / DEV_BSIZE);
+ sc->nsect = (mdio->md_size * DEV_BSIZE) / sc->secsize;
sc->flags = mdio->md_options & (MD_COMPRESS | MD_FORCE);
sc->indir = dimension(sc->nsect);
sc->uma = uma_zcreate(sc->name, sc->secsize,
OpenPOWER on IntegriCloud