diff options
author | Ashutosh Dixit <ashutosh.dixit@intel.com> | 2020-04-13 11:25:25 -0700 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2020-04-15 13:51:41 +0100 |
commit | c4c0d56843184fd61096ecb6ff94f059c2a54a7b (patch) | |
tree | fcdfded8c6ed91550451ee5eee66c27906de62d7 /tests/i915/gem_shrink.c | |
parent | c7b4a43942be32245b1c00b5b4a38401d8ca6e0d (diff) |
igt/gem_shrink: Fix reversed logic when mmap fails
Can't touch the memory if mmap returns MAP_FAILED.
v2: s/(char *)-1)/MAP_FAILED/ (Mike Ruhl)
Fixes: 9cff3be127("igt/gem_shrink: Reduce oom spam")
Signed-off-by: Ashutosh Dixit <ashutosh.dixit@intel.com>
Reviewed-by: Michael J. Ruhl <michael.j.ruhl@intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'tests/i915/gem_shrink.c')
-rw-r--r-- | tests/i915/gem_shrink.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/tests/i915/gem_shrink.c b/tests/i915/gem_shrink.c index 11aa9efc..e434613e 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 == MAP_FAILED) return; while (alloc) { |