Module Name: src
Committed By: maxv
Date: Sat Apr 4 06:00:12 UTC 2015
Modified Files:
src/sys/ufs/ffs: ffs_vfsops.c
Log Message:
ffs_superblock_validate(): ensure fs_ncg!=0 and fs_maxbpg!=0 to prevent
several divisions by zero.
To generate a diff of this commit:
cvs rdiff -u -r1.327 -r1.328 src/sys/ufs/ffs/ffs_vfsops.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/ufs/ffs/ffs_vfsops.c
diff -u src/sys/ufs/ffs/ffs_vfsops.c:1.327 src/sys/ufs/ffs/ffs_vfsops.c:1.328
--- src/sys/ufs/ffs/ffs_vfsops.c:1.327 Sat Mar 28 19:24:04 2015
+++ src/sys/ufs/ffs/ffs_vfsops.c Sat Apr 4 06:00:12 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: ffs_vfsops.c,v 1.327 2015/03/28 19:24:04 maxv Exp $ */
+/* $NetBSD: ffs_vfsops.c,v 1.328 2015/04/04 06:00:12 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.327 2015/03/28 19:24:04 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ffs_vfsops.c,v 1.328 2015/04/04 06:00:12 maxv Exp $");
#if defined(_KERNEL_OPT)
#include "opt_ffs.h"
@@ -952,6 +952,10 @@ ffs_superblock_validate(struct fs *fs)
return 0;
if (fs->fs_fpg == 0)
return 0;
+ if (fs->fs_ncg == 0)
+ return 0;
+ if (fs->fs_maxbpg == 0)
+ return 0;
/* Check the number of inodes per block */
if (fs->fs_magic == FS_UFS1_MAGIC)