summaryrefslogtreecommitdiffstats
path: root/sys/geom/label
diff options
context:
space:
mode:
Diffstat (limited to 'sys/geom/label')
-rw-r--r--sys/geom/label/g_label_ext2fs.c3
-rw-r--r--sys/geom/label/g_label_reiserfs.c16
2 files changed, 13 insertions, 6 deletions
diff --git a/sys/geom/label/g_label_ext2fs.c b/sys/geom/label/g_label_ext2fs.c
index 1825237..379785f 100644
--- a/sys/geom/label/g_label_ext2fs.c
+++ b/sys/geom/label/g_label_ext2fs.c
@@ -58,6 +58,9 @@ g_label_ext2fs_taste(struct g_consumer *cp, char *label, size_t size)
pp = cp->provider;
label[0] = '\0';
+ if ((EXT2FS_SB_OFFSET % pp->sectorsize) != 0)
+ return;
+
fs = (e2sb_t *)g_read_data(cp, EXT2FS_SB_OFFSET, pp->sectorsize, NULL);
if (fs == NULL)
return;
diff --git a/sys/geom/label/g_label_reiserfs.c b/sys/geom/label/g_label_reiserfs.c
index 8ef1ec8..c2bee71 100644
--- a/sys/geom/label/g_label_reiserfs.c
+++ b/sys/geom/label/g_label_reiserfs.c
@@ -49,11 +49,17 @@ typedef struct resiserfs_sb {
} reiserfs_sb_t;
static reiserfs_sb_t *
-g_label_reiserfs_read_super(struct g_consumer *cp, off_t offset, off_t len)
+g_label_reiserfs_read_super(struct g_consumer *cp, off_t offset)
{
reiserfs_sb_t *fs;
+ u_int secsize;
- fs = (reiserfs_sb_t *)g_read_data(cp, offset, len, NULL);
+ secsize = cp->provider->sectorsize;
+
+ if ((offset % secsize) != 0)
+ return (NULL);
+
+ fs = (reiserfs_sb_t *)g_read_data(cp, offset, secsize, NULL);
if (fs == NULL)
return (NULL);
@@ -77,12 +83,10 @@ g_label_reiserfs_taste(struct g_consumer *cp, char *label, size_t size)
label[0] = '\0';
/* Try old format */
- fs = g_label_reiserfs_read_super(cp, REISERFS_OLD_DISK_OFFSET,
- pp->sectorsize);
+ fs = g_label_reiserfs_read_super(cp, REISERFS_OLD_DISK_OFFSET);
if (fs == NULL) {
/* Try new format */
- fs = g_label_reiserfs_read_super(cp, REISERFS_NEW_DISK_OFFSET,
- pp->sectorsize);
+ fs = g_label_reiserfs_read_super(cp, REISERFS_NEW_DISK_OFFSET);
}
if (fs == NULL)
return;
OpenPOWER on IntegriCloud