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

Ruhl, Michael J michael.j.ruhl at intel.com
Mon Apr 13 17:29:40 UTC 2020


>-----Original Message-----
>From: igt-dev <igt-dev-bounces at lists.freedesktop.org> On Behalf Of
>Ashutosh Dixit
>Sent: Sunday, April 12, 2020 10:05 PM
>To: igt-dev at lists.freedesktop.org
>Cc: Chris Wilson <chris at chris-wilson.co.uk>
>Subject: [igt-dev] [PATCH i-g-t] igt/gem_shrink: Fix reversed logic when mmap
>fails
>
>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)

AKA MAP_FAILED?

M


> 		return;
>
> 	while (alloc) {
>--
>2.26.0
>
>_______________________________________________
>igt-dev mailing list
>igt-dev at lists.freedesktop.org
>https://lists.freedesktop.org/mailman/listinfo/igt-dev


More information about the igt-dev mailing list