freedreno/cffdec: Fix gpuaddr comparision

gpuaddrs are 64b, and they can be more than 2^^32 apart.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12489>
This commit is contained in:
Rob Clark 2021-08-20 10:48:57 -07:00 committed by Marge Bot
parent 32f13cb9bc
commit ed8d3095ab
1 changed files with 6 additions and 1 deletions

View File

@ -55,7 +55,12 @@ buffer_insert_cmp(const struct rb_node *n1, const struct rb_node *n2)
{
const struct buffer *buf1 = (const struct buffer *)n1;
const struct buffer *buf2 = (const struct buffer *)n2;
return buf1->gpuaddr - buf2->gpuaddr;
/* Note that gpuaddr comparisions can overflow an int: */
if (buf1->gpuaddr > buf2->gpuaddr)
return 1;
else if (buf1->gpuaddr < buf2->gpuaddr)
return -1;
return 0;
}
static int