Mesa (master): egl: Fix _eglPointerIsDereferencable() to ignore page residency

Emil Velikov evelikov at kemper.freedesktop.org
Mon Jul 24 10:02:16 UTC 2017


Module: Mesa
Branch: master
Commit: 63c251e38f9b4ac3606094a72c8c5b658402f3d0
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=63c251e38f9b4ac3606094a72c8c5b658402f3d0

Author: Miguel A. Vico <mvicomoya at nvidia.com>
Date:   Wed Jul 19 17:25:57 2017 -0700

egl: Fix _eglPointerIsDereferencable() to ignore page residency

mincore() returns 0 on success, and -1 on failure.  The last parameter
is a vector of bytes with one entry for each page queried.  mincore
returns page residency information in the first bit of each byte in the
vector.

Residency doesn't actually matter when determining whether a pointer is
dereferenceable, so the output vector can be ignored.  What matters is
whether mincore succeeds. See:

  http://man7.org/linux/man-pages/man2/mincore.2.html

Signed-off-by: Miguel A. Vico <mvicomoya at nvidia.com>
Acked-by: Daniel Stone <daniels at collabora.com>
Reviewed-by: Emil Velikov <emil.velikov at collabora.com>

---

 src/egl/main/eglglobals.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/src/egl/main/eglglobals.c b/src/egl/main/eglglobals.c
index 6fdc6c31ce..9071226618 100644
--- a/src/egl/main/eglglobals.c
+++ b/src/egl/main/eglglobals.c
@@ -168,7 +168,18 @@ _eglPointerIsDereferencable(void *p)
       return EGL_FALSE;
    }
 
-   return (valid & 0x01) == 0x01;
+   /* mincore() returns 0 on success, and -1 on failure.  The last parameter
+    * is a vector of bytes with one entry for each page queried.  mincore
+    * returns page residency information in the first bit of each byte in the
+    * vector.
+    *
+    * Residency doesn't actually matter when determining whether a pointer is
+    * dereferenceable, so the output vector can be ignored.  What matters is
+    * whether mincore succeeds. See:
+    *
+    *   http://man7.org/linux/man-pages/man2/mincore.2.html
+    */
+   return EGL_TRUE;
 #else
    return p != NULL;
 #endif




More information about the mesa-commit mailing list