[Mesa-dev] [PATCH] i915: Fix logic_op check.
Ian Romanick
idr at freedesktop.org
Mon Oct 28 23:53:51 CET 2013
On 10/26/2013 12:36 AM, Vinson Lee wrote:
> logic_op is of type GLenum (unsigned int).
>
> Fixes "Macro compares unsigned to 0" defect reported by Coverity.
>
> Signed-off-by: Vinson Lee <vlee at freedesktop.org>
> ---
> src/mesa/drivers/dri/i915/intel_blit.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/mesa/drivers/dri/i915/intel_blit.c b/src/mesa/drivers/dri/i915/intel_blit.c
> index 7b59708..9a66736 100644
> --- a/src/mesa/drivers/dri/i915/intel_blit.c
> +++ b/src/mesa/drivers/dri/i915/intel_blit.c
> @@ -534,7 +534,7 @@ intelEmitImmediateColorExpandBlit(struct intel_context *intel,
> return false;
> }
>
> - assert( logic_op - GL_CLEAR >= 0 );
> + assert( logic_op >= GL_CLEAR );
> assert( logic_op - GL_CLEAR < 0x10 );
I'd squash both of these together:
assert((logic_op >= GL_CLEAR) && (logic_op <= (GL_CLEAR + 0x0f)));
GL_CLEAR + 0x0f is GL_SET, but who remembers that? Assuming that change
also makes Coverity happy,
Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>
It looks like src/mesa/drivers/dri/i965/intel_blit.c has the same
assertions. The same fix on that file is preemptively R-b. :)
> assert(dst_pitch > 0);
>
>
More information about the mesa-dev
mailing list