Module Name:    src
Committed By:   jakllsch
Date:           Sat Jun 27 16:10:25 UTC 2009

Modified Files:
        src/sys/dev/dm: device-mapper.c dm_table.c

Log Message:
Some fixes for dm(4).

 - Limit accesses to the size of the volume.
   This fixes a KASSERT in physio_biodone().
 - Change dm_table_size() to return the size of the volume in
   DEV_BSIZE units.  It was reporting it in DEV_BSIZE^2 units.
 - Remove a bit of trailing whitespace.

ok haad


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/dm/device-mapper.c
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/dm/dm_table.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/dev/dm/device-mapper.c
diff -u src/sys/dev/dm/device-mapper.c:1.7 src/sys/dev/dm/device-mapper.c:1.8
--- src/sys/dev/dm/device-mapper.c:1.7	Fri Jun  5 21:52:31 2009
+++ src/sys/dev/dm/device-mapper.c	Sat Jun 27 16:10:25 2009
@@ -1,4 +1,4 @@
-/*        $NetBSD: device-mapper.c,v 1.7 2009/06/05 21:52:31 haad Exp $ */
+/*        $NetBSD: device-mapper.c,v 1.8 2009/06/27 16:10:25 jakllsch Exp $ */
 
 /*
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -391,6 +391,14 @@
 		return;
 	} 
 
+	if (bounds_check_with_mediasize(bp, DEV_BSIZE,
+	    dm_table_size(&dmv->table_head)) <= 0) {
+		dm_dev_unbusy(dmv);
+		bp->b_resid = bp->b_bcount;
+		biodone(bp);
+		return;
+	}
+
 	/* FIXME: have to be called with IPL_BIO*/
 	disk_busy(dmv->diskp);
 	
@@ -443,7 +451,7 @@
 
 			table_en->target->strategy(table_en, nestbuf);
 		}
-	}	
+	}
 
 	if (issued_len < buf_len)
 		nestiobuf_done(bp, buf_len - issued_len, EINVAL);

Index: src/sys/dev/dm/dm_table.c
diff -u src/sys/dev/dm/dm_table.c:1.2 src/sys/dev/dm/dm_table.c:1.3
--- src/sys/dev/dm/dm_table.c:1.2	Fri Dec 19 15:24:03 2008
+++ src/sys/dev/dm/dm_table.c	Sat Jun 27 16:10:25 2009
@@ -1,4 +1,4 @@
-/*        $NetBSD: dm_table.c,v 1.2 2008/12/19 15:24:03 haad Exp $      */
+/*        $NetBSD: dm_table.c,v 1.3 2009/06/27 16:10:25 jakllsch Exp $      */
 
 /*
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -206,7 +206,7 @@
 
 	dm_table_unbusy(head);
 	
-	return length / DEV_BSIZE;
+	return length;
 }
 
 /*

Reply via email to