[igt-dev] [PATCH i-g-t] igt/gem_shrink: Fix reversed logic when mmap fails

Ashutosh Dixit ashutosh.dixit at intel.com
Mon Apr 13 02:05:09 UTC 2020


Can't touch the memory if mmap returns MAP_FAILED.

Fixes: 9cff3be127("igt/gem_shrink: Reduce oom spam")
Signed-off-by: Ashutosh Dixit <ashutosh.dixit at intel.com>
---
 tests/i915/gem_shrink.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/i915/gem_shrink.c b/tests/i915/gem_shrink.c
index 11aa9efc1..bb55a4a78 100644
--- a/tests/i915/gem_shrink.c
+++ b/tests/i915/gem_shrink.c
@@ -274,7 +274,7 @@ static void leak(int fd, uint64_t alloc)
 	ptr = mmap(NULL, alloc, PROT_READ | PROT_WRITE,
 		   MAP_ANON | MAP_PRIVATE | MAP_POPULATE,
 		   -1, 0);
-	if (ptr != (char *)-1)
+	if (ptr == (char *)-1)
 		return;
 
 	while (alloc) {
-- 
2.26.0



More information about the igt-dev mailing list