public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
* [igt-dev] [PATCH i-g-t] igt/gem_shrink: Fix reversed logic when mmap fails
@ 2020-04-13  2:05 Ashutosh Dixit
  2020-04-13  3:32 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Ashutosh Dixit @ 2020-04-13  2:05 UTC (permalink / raw)
  To: igt-dev; +Cc: Chris Wilson

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@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

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply related	[flat|nested] 7+ messages in thread
* [igt-dev] [PATCH i-g-t] igt/gem_shrink: Fix reversed logic when mmap fails
@ 2020-04-13 18:25 Ashutosh Dixit
  2020-04-13 18:27 ` Ruhl, Michael J
  0 siblings, 1 reply; 7+ messages in thread
From: Ashutosh Dixit @ 2020-04-13 18:25 UTC (permalink / raw)
  To: igt-dev; +Cc: Chris Wilson

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>
---
 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..e434613eb 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) {
-- 
2.26.0

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2020-04-14  9:28 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-04-13  2:05 [igt-dev] [PATCH i-g-t] igt/gem_shrink: Fix reversed logic when mmap fails Ashutosh Dixit
2020-04-13  3:32 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork
2020-04-13 17:29 ` [igt-dev] [PATCH i-g-t] " Ruhl, Michael J
2020-04-14  5:59 ` [igt-dev] ✗ Fi.CI.IGT: failure for " Patchwork
  -- strict thread matches above, loose matches on Subject: below --
2020-04-13 18:25 [igt-dev] [PATCH i-g-t] " Ashutosh Dixit
2020-04-13 18:27 ` Ruhl, Michael J
2020-04-14  9:28   ` Chris Wilson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox