Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/ufs/ffs Fix PR 50070. From hannken@.



details:   https://anonhg.NetBSD.org/src/rev/24bea4382d76
branches:  trunk
changeset: 341162:24bea4382d76
user:      maxv <maxv%NetBSD.org@localhost>
date:      Thu Oct 22 11:31:31 2015 +0000

description:
Fix PR 50070. From hannken@.

diffstat:

 sys/ufs/ffs/ffs_vfsops.c |  26 ++++++--------------------
 1 files changed, 6 insertions(+), 20 deletions(-)

diffs (54 lines):

diff -r 06da480f4f6d -r 24bea4382d76 sys/ufs/ffs/ffs_vfsops.c
--- a/sys/ufs/ffs/ffs_vfsops.c  Thu Oct 22 10:51:16 2015 +0000
+++ b/sys/ufs/ffs/ffs_vfsops.c  Thu Oct 22 11:31:31 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ffs_vfsops.c,v 1.335 2015/07/24 13:02:52 maxv Exp $    */
+/*     $NetBSD: ffs_vfsops.c,v 1.336 2015/10/22 11:31:31 maxv Exp $    */
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -61,7 +61,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ffs_vfsops.c,v 1.335 2015/07/24 13:02:52 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ffs_vfsops.c,v 1.336 2015/10/22 11:31:31 maxv Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_ffs.h"
@@ -899,7 +899,7 @@
 ffs_superblock_validate(struct fs *fs)
 {
        int32_t i, fs_bshift = 0, fs_fshift = 0, fs_fragshift = 0, fs_frag;
-       int32_t fs_inopb, fs_cgsize;
+       int32_t fs_inopb;
 
        /* Check the superblock size */
        if (fs->fs_sbsize > SBLOCKSIZE || fs->fs_sbsize < sizeof(struct fs))
@@ -981,23 +981,9 @@
                return 0;
 
        /* Check the size of cylinder groups */
-       fs_cgsize = ffs_fragroundup(fs, CGSIZE(fs));
-       if (fs->fs_cgsize != fs_cgsize) {
-               if (fs->fs_cgsize+1 == CGSIZE(fs)) {
-                       printf("CGSIZE(fs) miscalculated by one - this file "
-                           "system may have been created by\n"
-                           "  an old (buggy) userland, see\n"
-                           "  http://www.NetBSD.org/";
-                           "docs/ffsv1badsuperblock.html\n");
-               } else {
-                       printf("ERROR: cylinder group size mismatch: "
-                           "fs_cgsize = 0x%zx, "
-                           "fs->fs_cgsize = 0x%zx, CGSIZE(fs) = 0x%zx\n",
-                           (size_t)fs_cgsize, (size_t)fs->fs_cgsize,
-                           (size_t)CGSIZE(fs));
-                       return 0;
-               }
-       }
+       if ((fs->fs_cgsize < sizeof(struct cg)) ||
+           (fs->fs_cgsize > fs->fs_bsize))
+               return 0;
 
        return 1;
 }



Home | Main Index | Thread Index | Old Index