From: Nicolai Hähnle Date: Fri, 21 Apr 2017 13:11:34 +0000 (+0200) Subject: st/mesa: remove redundant stfb->iface checks X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=9d346af322e3f9d6d52e00759e8c3cd37c192004;p=mesa.git st/mesa: remove redundant stfb->iface checks stfb->iface is always non-NULL for an st_framebuffer. These checks were incorrect, relying on out-of-bounds memory access in the surface-less case of EGL_KHR_surfaceless_context. v2: remove redundant stread check (Marek) Reviewed-by: Marek Olšák (v2) --- diff --git a/src/mesa/state_tracker/st_cb_viewport.c b/src/mesa/state_tracker/st_cb_viewport.c index ff18fd0e6a4..8b50350fabb 100644 --- a/src/mesa/state_tracker/st_cb_viewport.c +++ b/src/mesa/state_tracker/st_cb_viewport.c @@ -54,9 +54,9 @@ static void st_viewport(struct gl_context *ctx) stdraw = st_ws_framebuffer(st->ctx->DrawBuffer); stread = st_ws_framebuffer(st->ctx->ReadBuffer); - if (stdraw && stdraw->iface) + if (stdraw) stdraw->iface_stamp = p_atomic_read(&stdraw->iface->stamp) - 1; - if (stread && stread != stdraw && stread->iface) + if (stread && stread != stdraw) stread->iface_stamp = p_atomic_read(&stread->iface->stamp) - 1; } diff --git a/src/mesa/state_tracker/st_manager.c b/src/mesa/state_tracker/st_manager.c index 2ba7de6c634..90e4177f696 100644 --- a/src/mesa/state_tracker/st_manager.c +++ b/src/mesa/state_tracker/st_manager.c @@ -176,10 +176,6 @@ st_framebuffer_validate(struct st_framebuffer *stfb, boolean changed = FALSE; int32_t new_stamp; - /* Check for incomplete framebuffers (e.g. EGL_KHR_surfaceless_context) */ - if (!stfb->iface) - return; - new_stamp = p_atomic_read(&stfb->iface->stamp); if (stfb->iface_stamp == new_stamp) return; @@ -281,9 +277,6 @@ st_framebuffer_add_renderbuffer(struct st_framebuffer *stfb, enum pipe_format format; boolean sw; - if (!stfb->iface) - return FALSE; - assert(_mesa_is_winsys_fbo(&stfb->Base)); /* do not distinguish depth/stencil buffers */