Source-Changes-HG archive

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

[src/trunk]: src/sys/rump/librump/rumpvfs Do bounds-checking before adding ho...



details:   https://anonhg.NetBSD.org/src/rev/607cbe0d2650
branches:  trunk
changeset: 749588:607cbe0d2650
user:      pooka <pooka%NetBSD.org@localhost>
date:      Thu Dec 03 14:05:46 2009 +0000

description:
Do bounds-checking before adding host offset.  Otherwise the host
offset would be counted in with "size" and incorrect operation
would ensue.

diffstat:

 sys/rump/librump/rumpvfs/rumpblk.c |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (34 lines):

diff -r 3478d8e34a9d -r 607cbe0d2650 sys/rump/librump/rumpvfs/rumpblk.c
--- a/sys/rump/librump/rumpvfs/rumpblk.c        Thu Dec 03 13:45:11 2009 +0000
+++ b/sys/rump/librump/rumpvfs/rumpblk.c        Thu Dec 03 14:05:46 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rumpblk.c,v 1.33 2009/12/02 17:18:59 pooka Exp $       */
+/*     $NetBSD: rumpblk.c,v 1.34 2009/12/03 14:05:46 pooka Exp $       */
 
 /*
  * Copyright (c) 2009 Antti Kantee.  All Rights Reserved.
@@ -52,7 +52,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rumpblk.c,v 1.33 2009/12/02 17:18:59 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rumpblk.c,v 1.34 2009/12/03 14:05:46 pooka Exp $");
 
 #include <sys/param.h>
 #include <sys/buf.h>
@@ -593,7 +593,6 @@
        }
 
        off = bp->b_blkno << DEV_BSHIFT;
-       off += rblk->rblk_hostoffset;
        /*
         * Do bounds checking if we're working on a file.  Otherwise
         * invalid file systems might attempt to read beyond EOF.  This
@@ -618,6 +617,7 @@
                bp->b_bcount = sz;
        }
 
+       off += rblk->rblk_hostoffset;
        DPRINTF(("rumpblk_strategy: 0x%x bytes %s off 0x%" PRIx64
            " (0x%" PRIx64 " - 0x%" PRIx64 "), %ssync\n",
            bp->b_bcount, BUF_ISREAD(bp) ? "READ" : "WRITE",



Home | Main Index | Thread Index | Old Index