From: Ashutosh Dixit <ashutosh.dixit@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Subject: [igt-dev] [PATCH i-g-t] igt/gem_shrink: Fix reversed logic when mmap fails
Date: Mon, 13 Apr 2020 11:25:25 -0700 [thread overview]
Message-ID: <20200413182525.1581-1-ashutosh.dixit@intel.com> (raw)
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
next reply other threads:[~2020-04-13 18:25 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-13 18:25 Ashutosh Dixit [this message]
2020-04-13 18:27 ` [igt-dev] [PATCH i-g-t] igt/gem_shrink: Fix reversed logic when mmap fails Ruhl, Michael J
2020-04-14 9:28 ` Chris Wilson
2020-04-14 13:03 ` [igt-dev] ✓ Fi.CI.BAT: success for igt/gem_shrink: Fix reversed logic when mmap fails (rev2) Patchwork
2020-04-15 9:03 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
-- strict thread matches above, loose matches on Subject: below --
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 17:29 ` Ruhl, Michael J
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200413182525.1581-1-ashutosh.dixit@intel.com \
--to=ashutosh.dixit@intel.com \
--cc=chris@chris-wilson.co.uk \
--cc=igt-dev@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox