Module Name:    src
Committed By:   mrg
Date:           Sat Jun 20 19:24:27 UTC 2009

Modified Files:
        src/sys/sys: conf.h
        src/sys/uvm: uvm_device.c

Log Message:
add a workaround for drm:

for device mmap()'s, if the D_NEGOFFSAFE flag is set, do not check
if the offset is negative.

this should go away with the test itself when all drivers are audited
and checked to not fail with negative offsets.


To generate a diff of this commit:
cvs rdiff -u -r1.134 -r1.135 src/sys/sys/conf.h
cvs rdiff -u -r1.55 -r1.56 src/sys/uvm/uvm_device.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/sys/conf.h
diff -u src/sys/sys/conf.h:1.134 src/sys/sys/conf.h:1.135
--- src/sys/sys/conf.h:1.134	Mon Feb  2 14:00:27 2009
+++ src/sys/sys/conf.h	Sat Jun 20 19:24:27 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: conf.h,v 1.134 2009/02/02 14:00:27 haad Exp $	*/
+/*	$NetBSD: conf.h,v 1.135 2009/06/20 19:24:27 mrg Exp $	*/
 
 /*-
  * Copyright (c) 1990, 1993
@@ -61,6 +61,7 @@
 #define	D_TTY		0x0003
 #define	D_TYPEMASK	0x00ff
 #define	D_MPSAFE	0x0100
+#define	D_NEGOFFSAFE	0x0200
 
 /*
  * Block device switch table

Index: src/sys/uvm/uvm_device.c
diff -u src/sys/uvm/uvm_device.c:1.55 src/sys/uvm/uvm_device.c:1.56
--- src/sys/uvm/uvm_device.c:1.55	Wed Dec 17 20:51:39 2008
+++ src/sys/uvm/uvm_device.c	Sat Jun 20 19:24:27 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_device.c,v 1.55 2008/12/17 20:51:39 cegger Exp $	*/
+/*	$NetBSD: uvm_device.c,v 1.56 2009/06/20 19:24:27 mrg Exp $	*/
 
 /*
  *
@@ -39,7 +39,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uvm_device.c,v 1.55 2008/12/17 20:51:39 cegger Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_device.c,v 1.56 2009/06/20 19:24:27 mrg Exp $");
 
 #include "opt_uvmhist.h"
 
@@ -143,7 +143,8 @@
 	 * Negative offsets on the object are not allowed.
 	 */
 
-	if (off != UVM_UNKNOWN_OFFSET && off < 0)
+	if ((cdev->d_flag & D_NEGOFFSAFE) == 0 &&
+	    off != UVM_UNKNOWN_OFFSET && off < 0)
 		return(NULL);
 
 	/*

Reply via email to