[Mesa-dev] [PATCH] mesa: Use signed math for possibly negative values

Chad Versace chad at chad-versace.us
Thu May 19 13:38:21 PDT 2011


On 05/19/2011 01:19 PM, Chad Versace wrote:
> On 05/19/2011 05:13 AM, Ian Romanick wrote:
>> From: Ian Romanick <ian.d.romanick at intel.com>
>>
>> Since RowStride might be negative, we want a signed result.  On 64-bit
>> platforms, an unsigned 32-bit result added to a 64-bit pointer will
>> give the wrong answer.
>
> Looks like all eyes were on this bug. I was just about a submit this
> patch to the list myself.
> 
> Reviewed-by: Chad Versace <chad.versace at intel.com>

Oops, I just saw airlied's patch. I prefer airlie's approach because it
prevents future bugs arising from similiar misuse of
_mesa_get_format_bytes(). I think that if we rely on an explicit cast
here, in the future someone will forget to do the cast and this bug will
reappear.

-- 
Chad Versace
chad at chad-versace.us


More information about the mesa-dev mailing list