summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>1996-01-01 20:20:45 +0000
committerphk <phk@FreeBSD.org>1996-01-01 20:20:45 +0000
commitd63b42b7f8e3590e3c4895f1ffef6a01ff0cc5e2 (patch)
tree2fd7788cf6daf241e2799b249b0046bbcf5a3765
parente61201fedd92413a849c7996f2d2937ab3245655 (diff)
downloadFreeBSD-src-d63b42b7f8e3590e3c4895f1ffef6a01ff0cc5e2.zip
FreeBSD-src-d63b42b7f8e3590e3c4895f1ffef6a01ff0cc5e2.tar.gz
I have some problem here, which shows up in the ahc0 driver. It isn't where
it originates, so I catch it here and fail. This may expose the same bug on other disk controllers (both scsi & ide).
-rw-r--r--sys/fs/specfs/spec_vnops.c8
-rw-r--r--sys/miscfs/specfs/spec_vnops.c8
2 files changed, 14 insertions, 2 deletions
diff --git a/sys/fs/specfs/spec_vnops.c b/sys/fs/specfs/spec_vnops.c
index 14d9939..a78298e 100644
--- a/sys/fs/specfs/spec_vnops.c
+++ b/sys/fs/specfs/spec_vnops.c
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)spec_vnops.c 8.6 (Berkeley) 4/9/94
- * $Id: spec_vnops.c,v 1.25 1995/12/13 15:13:31 julian Exp $
+ * $Id: spec_vnops.c,v 1.26 1995/12/14 09:53:06 phk Exp $
*/
#include <sys/param.h>
@@ -756,6 +756,12 @@ spec_getpages(ap)
*/
blkno = (IDX_TO_OFF(ap->a_m[0]->pindex) + ap->a_offset) / DEV_BSIZE;
+ /* XXX sanity check before we go into details */
+ if (blkno < 0) {
+ printf("spec_getpages: negative blkno (%ld)\n", blkno);
+ return (VM_PAGER_ERROR);
+ }
+
/*
* Round up physical size for real devices.
*/
diff --git a/sys/miscfs/specfs/spec_vnops.c b/sys/miscfs/specfs/spec_vnops.c
index 14d9939..a78298e 100644
--- a/sys/miscfs/specfs/spec_vnops.c
+++ b/sys/miscfs/specfs/spec_vnops.c
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)spec_vnops.c 8.6 (Berkeley) 4/9/94
- * $Id: spec_vnops.c,v 1.25 1995/12/13 15:13:31 julian Exp $
+ * $Id: spec_vnops.c,v 1.26 1995/12/14 09:53:06 phk Exp $
*/
#include <sys/param.h>
@@ -756,6 +756,12 @@ spec_getpages(ap)
*/
blkno = (IDX_TO_OFF(ap->a_m[0]->pindex) + ap->a_offset) / DEV_BSIZE;
+ /* XXX sanity check before we go into details */
+ if (blkno < 0) {
+ printf("spec_getpages: negative blkno (%ld)\n", blkno);
+ return (VM_PAGER_ERROR);
+ }
+
/*
* Round up physical size for real devices.
*/
OpenPOWER on IntegriCloud