Source-Changes-HG archive

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

[src/trunk]: src/sys/ufs/ufs ufs_getlbns:



details:   https://anonhg.NetBSD.org/src/rev/ef519ed8eaee
branches:  trunk
changeset: 569984:ef519ed8eaee
user:      yamt <yamt%NetBSD.org@localhost>
date:      Wed Sep 15 09:52:49 2004 +0000

description:
ufs_getlbns:
- fix an integer overflow when calculating lbns of indirect blocks.
- remove a redundant calculation of blockcnt.

diffstat:

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

diffs (35 lines):

diff -r d284be9c0325 -r ef519ed8eaee sys/ufs/ufs/ufs_bmap.c
--- a/sys/ufs/ufs/ufs_bmap.c    Wed Sep 15 09:50:56 2004 +0000
+++ b/sys/ufs/ufs/ufs_bmap.c    Wed Sep 15 09:52:49 2004 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ufs_bmap.c,v 1.32 2004/08/15 21:34:14 mycroft Exp $    */
+/*     $NetBSD: ufs_bmap.c,v 1.33 2004/09/15 09:52:49 yamt Exp $       */
 
 /*
  * Copyright (c) 1989, 1991, 1993
@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ufs_bmap.c,v 1.32 2004/08/15 21:34:14 mycroft Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ufs_bmap.c,v 1.33 2004/09/15 09:52:49 yamt Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -396,7 +396,6 @@
                        break;
 
                lbc -= ump->um_lognindir;
-               blockcnt = (int64_t)1 << lbc;
                off = (bn >> lbc) & (MNINDIR(ump) - 1);
 
                ++numlevels;
@@ -405,7 +404,7 @@
                ap->in_exists = 0;
                ++ap;
 
-               metalbn -= -1 + (off << lbc);
+               metalbn -= -1 + ((int64_t)off << lbc);
        }
        if (nump)
                *nump = numlevels;



Home | Main Index | Thread Index | Old Index