[Mesa-dev] [PATCH 4/5] egl: Unhide functionality in _eglInitSync()

Ian Romanick idr at freedesktop.org
Mon Feb 17 12:45:23 PST 2014


On 02/14/2014 05:23 AM, Juha-Pekka Heikkila wrote:
> _eglInitResource() was used to memset entire _EGLSync by
> writing more than size of pointed target. This does work
> as long as Resource is the first element in _EGLSync,
> this patch fixes such dependency.

NAK.  It's not a random dependency, it's inheritance.  If _EGLResource
isn't the first element of _EGLSync, this will be the least of the code
that needs to change.

> Signed-off-by: Juha-Pekka Heikkila <juhapekka.heikkila at gmail.com>
> ---
>  src/egl/main/eglsync.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/src/egl/main/eglsync.c b/src/egl/main/eglsync.c
> index 9d0067c..ba8a32f 100644
> --- a/src/egl/main/eglsync.c
> +++ b/src/egl/main/eglsync.c
> @@ -75,7 +75,8 @@ _eglInitSync(_EGLSync *sync, _EGLDisplay *dpy, EGLenum type,
>         !(type == EGL_SYNC_FENCE_KHR && dpy->Extensions.KHR_fence_sync))
>        return _eglError(EGL_BAD_ATTRIBUTE, "eglCreateSyncKHR");
>  
> -   _eglInitResource(&sync->Resource, sizeof(*sync), dpy);
> +   memset(sync, 0, sizeof(_EGLSync));
> +   _eglInitResource(&sync->Resource, sizeof(_EGLResource), dpy);
>     sync->Type = type;
>     sync->SyncStatus = EGL_UNSIGNALED_KHR;
>     sync->SyncCondition = EGL_SYNC_PRIOR_COMMANDS_COMPLETE_KHR;
> 



More information about the mesa-dev mailing list