Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/external/bsd/drm2/dist/drm Avoid zero-size uao.



details:   https://anonhg.NetBSD.org/src/rev/344286e6d4bb
branches:  trunk
changeset: 818833:344286e6d4bb
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Thu Nov 03 00:10:49 2016 +0000

description:
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

diffstat:

 sys/external/bsd/drm2/dist/drm/drm_gem.c |  6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diffs (16 lines):

diff -r beb00ce1774d -r 344286e6d4bb sys/external/bsd/drm2/dist/drm/drm_gem.c
--- a/sys/external/bsd/drm2/dist/drm/drm_gem.c  Wed Nov 02 22:18:04 2016 +0000
+++ b/sys/external/bsd/drm2/dist/drm/drm_gem.c  Thu Nov 03 00:10:49 2016 +0000
@@ -154,7 +154,11 @@
        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,



Home | Main Index | Thread Index | Old Index