summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sys/ufs/ffs/ffs_vfsops.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/sys/ufs/ffs/ffs_vfsops.c b/sys/ufs/ffs/ffs_vfsops.c
index 2ef75f8..7378b64 100644
--- a/sys/ufs/ffs/ffs_vfsops.c
+++ b/sys/ufs/ffs/ffs_vfsops.c
@@ -616,7 +616,14 @@ ffs_mountfs(devvp, mp, td)
* Try reading the superblock in each of its possible locations.
*/
for (i = 0; sblock_try[i] != -1; i++) {
- if ((error = bread(devvp, sblock_try[i] / DEV_BSIZE, SBLOCKSIZE,
+ if ((SBLOCKSIZE % cp->provider->sectorsize) != 0) {
+ error = EINVAL;
+ vfs_mount_error(mp,
+ "Invalid sectorsize %d for superblock size %d",
+ cp->provider->sectorsize, SBLOCKSIZE);
+ goto out;
+ }
+ if ((error = bread(devvp, btodb(sblock_try[i]), SBLOCKSIZE,
cred, &bp)) != 0)
goto out;
fs = (struct fs *)bp->b_data;
OpenPOWER on IntegriCloud