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@nvidia.com>
Acked-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
This commit is contained in:
Miguel A. Vico 2017-07-19 17:25:57 -07:00 committed by Emil Velikov
parent 045108938c
commit 63c251e38f
1 changed files with 12 additions and 1 deletions

View File

@ -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