diff options
| author | 2007-04-21 23:22:42 +0000 | |
|---|---|---|
| committer | 2007-04-21 23:22:42 +0000 | |
| commit | b940616f1b661436ea0a1de421b2af93d90095c3 (patch) | |
| tree | dd701f6b339d97498b5e5151f2fa56ba9e6e504e /sys/dev/softraid.c | |
| parent | Add volumes to sensors. (diff) | |
| download | wireguard-openbsd-b940616f1b661436ea0a1de421b2af93d90095c3.tar.xz wireguard-openbsd-b940616f1b661436ea0a1de421b2af93d90095c3.zip | |
Account for mbr and partition table when writing meta data.
Error report by Johan Mson Lindman <tybollt@solace.miun.se>
Diffstat (limited to 'sys/dev/softraid.c')
| -rw-r--r-- | sys/dev/softraid.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/sys/dev/softraid.c b/sys/dev/softraid.c index ff6f7575c81..62781bc637a 100644 --- a/sys/dev/softraid.c +++ b/sys/dev/softraid.c @@ -1,4 +1,4 @@ -/* $OpenBSD: softraid.c,v 1.26 2007/04/21 23:05:19 marco Exp $ */ +/* $OpenBSD: softraid.c,v 1.27 2007/04/21 23:22:42 marco Exp $ */ /* * Copyright (c) 2007 Marco Peereboom <marco@peereboom.us> * @@ -1081,8 +1081,9 @@ sr_raid1_alloc_resources(struct sr_discipline *sd) sr_alloc_wu(sd); sr_alloc_ccb(sd); - sd->sd_meta = malloc(SR_META_SIZE * 512 , M_DEVBUF, M_WAITOK); - bzero(sd->sd_meta, SR_META_SIZE * 512); + /* -2 because that includes mbr and partition table */ + sd->sd_meta = malloc((SR_META_SIZE - 2) * 512 , M_DEVBUF, M_WAITOK); + bzero(sd->sd_meta, (SR_META_SIZE - 2) * 512); rv = 0; return (rv); @@ -1775,7 +1776,7 @@ sr_save_metadata(struct sr_discipline *sd) struct sr_chunk *src; struct buf b; int i, rv = 1; - size_t sz = SR_META_SIZE * 512; + size_t sz = (SR_META_SIZE - 2) * 512; DNPRINTF(SR_D_META, "%s: sr_save_metadata %s\n", DEVNAME(sc), sd->sd_vol.sv_meta.svm_devname); |
