From 1380e19dc8479a960c010a7a489dbe8d5dab1e99 Mon Sep 17 00:00:00 2001 From: Harshdeep Dhatt Date: Tue, 29 Dec 2015 11:09:16 -0700 Subject: msm: kgsl: Purge a memfree entry correctly For the case when newly allocated gpuaddr falls between a memfree entry's gpuaddr and size, the size of the mem entry was being truncated to a negative value. Fix the math to reflect the truncated size correctly. Change-Id: Id39519acc2af106240db8f41539b9fd1dc0cb0eb Signed-off-by: Harshdeep Dhatt --- drivers/gpu/msm/kgsl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/msm/kgsl.c b/drivers/gpu/msm/kgsl.c index f0e0008cb520..0d1c75b4b598 100644 --- a/drivers/gpu/msm/kgsl.c +++ b/drivers/gpu/msm/kgsl.c @@ -185,7 +185,7 @@ static void kgsl_memfree_purge(pid_t ptname, uint64_t gpuaddr, if (gpuaddr > entry->gpuaddr && gpuaddr < entry->gpuaddr + entry->size) { /* truncate the end of the entry */ - entry->size = entry->gpuaddr - gpuaddr; + entry->size = gpuaddr - entry->gpuaddr; } else if (gpuaddr <= entry->gpuaddr && gpuaddr + size < entry->gpuaddr + entry->size) /* Truncate the beginning of the entry */ -- cgit v1.2.3