Source-Changes-HG archive

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

[src/trunk]: src/sys/ufs/ffs Initialize blkno to 0 right before the snapblkad...



details:   https://anonhg.NetBSD.org/src/rev/a5339a4b7c30
branches:  trunk
changeset: 762588:a5339a4b7c30
user:      dyoung <dyoung%NetBSD.org@localhost>
date:      Wed Feb 23 17:05:33 2011 +0000

description:
Initialize blkno to 0 right before the snapblkaddr() call that GCC does
not understand so that if ffs_copyonwrite() sprouts a new code path that
does not initialize blkno, the compiler has the chance to reveal it.

diffstat:

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

diffs (35 lines):

diff -r 48ce41e00b15 -r a5339a4b7c30 sys/ufs/ffs/ffs_snapshot.c
--- a/sys/ufs/ffs/ffs_snapshot.c        Wed Feb 23 16:38:08 2011 +0000
+++ b/sys/ufs/ffs/ffs_snapshot.c        Wed Feb 23 17:05:33 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ffs_snapshot.c,v 1.108 2011/02/23 08:53:21 hannken Exp $       */
+/*     $NetBSD: ffs_snapshot.c,v 1.109 2011/02/23 17:05:33 dyoung Exp $        */
 
 /*
  * Copyright 2000 Marshall Kirk McKusick. All Rights Reserved.
@@ -38,7 +38,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ffs_snapshot.c,v 1.108 2011/02/23 08:53:21 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ffs_snapshot.c,v 1.109 2011/02/23 17:05:33 dyoung Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_ffs.h"
@@ -1826,8 +1826,6 @@
        uint32_t gen;
        int lower, upper, mid, snapshot_locked = 0, error = 0;
 
-       blkno = 0; /* XXX: GCC */
-
        /*
         * Check for valid snapshots.
         */
@@ -1898,6 +1896,7 @@
                        blkno = db_get(ip, lbn);
                } else {
                        mutex_exit(&si->si_lock);
+                       blkno = 0; /* XXX: GCC */
                        if ((error = snapblkaddr(vp, lbn, &blkno)) != 0) {
                                mutex_enter(&si->si_lock);
                                break;



Home | Main Index | Thread Index | Old Index