summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwollman <wollman@FreeBSD.org>2005-04-19 21:55:28 +0000
committerwollman <wollman@FreeBSD.org>2005-04-19 21:55:28 +0000
commitbc5273fd8fed8d43eee92b3166ab8270851b11a6 (patch)
tree009f45983ce7fb90c59c95f2a157ea5cded86555
parent15eddd96beb523e19af1df49c87f07d8ad4dfe95 (diff)
downloadFreeBSD-src-bc5273fd8fed8d43eee92b3166ab8270851b11a6.zip
FreeBSD-src-bc5273fd8fed8d43eee92b3166ab8270851b11a6.tar.gz
The size of a filesystem may be less than the size of the provider it
resides on. Fix the special case of the filesystem fragment size not evenly dividing the size of the provider. Fixing the general case probably requires better superblock validation (left as an exercise to the reader).
-rw-r--r--sys/geom/label/g_label_ufs.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/geom/label/g_label_ufs.c b/sys/geom/label/g_label_ufs.c
index d15cbec..1be6b85 100644
--- a/sys/geom/label/g_label_ufs.c
+++ b/sys/geom/label/g_label_ufs.c
@@ -86,8 +86,8 @@ g_label_ufs_taste(struct g_consumer *cp, char *label, size_t size)
} else if (fs->fs_magic == FS_UFS2_MAGIC) {
G_LABEL_DEBUG(1, "UFS2 file system detected on %s.",
pp->name);
- if (fs->fs_size * fs->fs_fsize !=
- (int64_t)pp->mediasize) {
+ if (fs->fs_fsize <= 0 ||
+ pp->mediasize / fs->fs_fsize != fs->fs_size) {
g_free(fs);
continue;
}
OpenPOWER on IntegriCloud