Module Name: src Committed By: pooka Date: Thu Dec 3 14:05:46 UTC 2009
Modified Files: src/sys/rump/librump/rumpvfs: rumpblk.c Log Message: Do bounds-checking before adding host offset. Otherwise the host offset would be counted in with "size" and incorrect operation would ensue. To generate a diff of this commit: cvs rdiff -u -r1.33 -r1.34 src/sys/rump/librump/rumpvfs/rumpblk.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/rump/librump/rumpvfs/rumpblk.c diff -u src/sys/rump/librump/rumpvfs/rumpblk.c:1.33 src/sys/rump/librump/rumpvfs/rumpblk.c:1.34 --- src/sys/rump/librump/rumpvfs/rumpblk.c:1.33 Wed Dec 2 17:18:59 2009 +++ src/sys/rump/librump/rumpvfs/rumpblk.c Thu Dec 3 14:05:46 2009 @@ -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",