diff options
author | 2008-01-24 13:54:47 +0000 | |
---|---|---|
committer | 2008-01-24 13:54:47 +0000 | |
commit | 979905abea7ce1dfab0dfb0693e020ef3ecbb071 (patch) | |
tree | 0ec3b14575b8204275a2dd6ea5d3b633a041c596 /sys/dev/softraid.c | |
parent | "read(..., ..., sizeof Y) < sizeof Y" is a dangerous idiom because it (diff) | |
download | wireguard-openbsd-979905abea7ce1dfab0dfb0693e020ef3ecbb071.tar.xz wireguard-openbsd-979905abea7ce1dfab0dfb0693e020ef3ecbb071.zip |
KNF
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 191e2e3ce63..689e1e7a7c5 100644 --- a/sys/dev/softraid.c +++ b/sys/dev/softraid.c @@ -1,4 +1,4 @@ -/* $OpenBSD: softraid.c,v 1.93 2008/01/20 17:20:10 marco Exp $ */ +/* $OpenBSD: softraid.c,v 1.94 2008/01/24 13:54:47 marco Exp $ */ /* * Copyright (c) 2007 Marco Peereboom <marco@peereboom.us> * @@ -823,7 +823,7 @@ sr_ioctl_createraid(struct sr_softc *sc, struct bioc_createraid *bc, int user) sd->sd_vol.sv_meta.svm_size = vol_size; sd->sd_vol.sv_meta.svm_status = BIOC_SVONLINE; sd->sd_vol.sv_meta.svm_level = bc->bc_level; - sd->sd_vol.sv_meta.svm_strip_size = strip_size; + sd->sd_vol.sv_meta.svm_strip_size = strip_size; strlcpy(sd->sd_vol.sv_meta.svm_vendor, "OPENBSD", sizeof(sd->sd_vol.sv_meta.svm_vendor)); snprintf(sd->sd_vol.sv_meta.svm_product, @@ -1065,8 +1065,9 @@ sr_open_chunks(struct sr_softc *sc, struct sr_chunk_head *cl, dev_t *dt, goto unwind; } - /* get partition size */ - ch_entry->src_size = size = DL_GETPSIZE(&label.d_partitions[part]) - + /* get partition size while accounting for metadata! */ + ch_entry->src_size = size = + DL_GETPSIZE(&label.d_partitions[part]) - SR_META_SIZE - SR_META_OFFSET; if (size <= 0) { printf("%s: %s partition too small\n", |