Module Name:    src
Committed By:   riastradh
Date:           Thu Nov  3 00:10:49 UTC 2016

Modified Files:
        src/sys/external/bsd/drm2/dist/drm: drm_gem.c

Log Message:
Avoid zero-size uao.

Apparently some GEM/TTM objects can be zero-size, as discovered by
Stefan Hertenberger:
https://mail-index.netbsd.org/current-users/2016/08/02/msg029891.html


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/external/bsd/drm2/dist/drm/drm_gem.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/external/bsd/drm2/dist/drm/drm_gem.c
diff -u src/sys/external/bsd/drm2/dist/drm/drm_gem.c:1.5 src/sys/external/bsd/drm2/dist/drm/drm_gem.c:1.6
--- src/sys/external/bsd/drm2/dist/drm/drm_gem.c:1.5	Mon Aug 18 01:21:03 2014
+++ src/sys/external/bsd/drm2/dist/drm/drm_gem.c	Thu Nov  3 00:10:49 2016
@@ -154,7 +154,11 @@ int drm_gem_object_init(struct drm_devic
 	drm_gem_private_object_init(dev, obj, size);
 
 #ifdef __NetBSD__
-	obj->gemo_shm_uao = uao_create(size, 0);
+	/*
+	 * A uao may not have size 0, but a gem object may.  Allocate a
+	 * spurious page so we needn't teach uao how to have size 0.
+	 */
+	obj->gemo_shm_uao = uao_create(MAX(size, PAGE_SIZE), 0);
 	/*
 	 * XXX This is gross.  We ought to do it the other way around:
 	 * set the uao to have the main uvm object's lock.  However,

Reply via email to