From: Christian König Date: Sat, 18 Jul 2015 17:20:05 +0000 (+0200) Subject: drm/amdgpu: fix signed overrun in amdgpu_ctx_get_fence X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=cf6f1d39496e9b5dd62953f8dca9f995d80ab4ff;p=linux-beck.git drm/amdgpu: fix signed overrun in amdgpu_ctx_get_fence Otherwise the first 16 fences of a context will always signal immediately. Signed-off-by: Christian König Reviewed-by: Jammy Zhou --- diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c index 859a4841075e..144edc97c6fe 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c @@ -226,7 +226,7 @@ struct fence *amdgpu_ctx_get_fence(struct amdgpu_ctx *ctx, return ERR_PTR(-EINVAL); } - if (seq < cring->sequence - AMDGPU_CTX_MAX_CS_PENDING) { + if (seq + AMDGPU_CTX_MAX_CS_PENDING < cring->sequence) { spin_unlock(&ctx->ring_lock); return NULL; }