Source-Changes-HG archive

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

[src/trunk]: src/sys/ufs/lfs Avoid NULL deref inside a KASSERT, as discussed ...



details:   https://anonhg.NetBSD.org/src/rev/08933e3971b4
branches:  trunk
changeset: 760470:08933e3971b4
user:      martin <martin%NetBSD.org@localhost>
date:      Wed Jan 05 19:34:27 2011 +0000

description:
Avoid NULL deref inside a KASSERT, as discussed on tech-kern.

diffstat:

 sys/ufs/lfs/lfs_vnops.c |  7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diffs (28 lines):

diff -r c4661dc7d30c -r 08933e3971b4 sys/ufs/lfs/lfs_vnops.c
--- a/sys/ufs/lfs/lfs_vnops.c   Wed Jan 05 18:47:28 2011 +0000
+++ b/sys/ufs/lfs/lfs_vnops.c   Wed Jan 05 19:34:27 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: lfs_vnops.c,v 1.233 2011/01/02 05:09:32 dholland Exp $ */
+/*     $NetBSD: lfs_vnops.c,v 1.234 2011/01/05 19:34:27 martin Exp $   */
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc.
@@ -60,7 +60,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: lfs_vnops.c,v 1.233 2011/01/02 05:09:32 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lfs_vnops.c,v 1.234 2011/01/05 19:34:27 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -1860,7 +1860,8 @@
                         * blocks outside our area of interest or beyond
                         * the end of file.
                         */
-                       KASSERT((curpg->flags & PG_MARKER) == 0);
+                       KASSERT(curpg == NULL
+                           || (curpg->flags & PG_MARKER) == 0);
                        if (pages_per_block > 1) {
                                while (curpg &&
                                    ((curpg->offset & fs->lfs_bmask) ||



Home | Main Index | Thread Index | Old Index