Mesa (staging/20.1): Properly check mmap return value

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri May 22 23:21:12 UTC 2020


Module: Mesa
Branch: staging/20.1
Commit: 6c108c1b4768ee890ecc85d3d587eb3823c1f680
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=6c108c1b4768ee890ecc85d3d587eb3823c1f680

Author: Hanno Böck <hanno at gentoo.org>
Date:   Thu May 21 18:51:06 2020 +0200

Properly check mmap return value

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5150>
(cherry picked from commit be71e2fd08b364f331a7e44d34f67954f0aeebe3)

---

 .pick_status.json                | 2 +-
 src/freedreno/perfcntrs/fdperf.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index 5d896744424..06e93389e1f 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -121,7 +121,7 @@
         "description": "Properly check mmap return value",
         "nominated": false,
         "nomination_type": null,
-        "resolution": 4,
+        "resolution": 1,
         "master_sha": null,
         "because_sha": null
     },
diff --git a/src/freedreno/perfcntrs/fdperf.c b/src/freedreno/perfcntrs/fdperf.c
index 3eb2f827a8d..e86595ae967 100644
--- a/src/freedreno/perfcntrs/fdperf.c
+++ b/src/freedreno/perfcntrs/fdperf.c
@@ -396,7 +396,7 @@ find_device(void)
 		err(1, "could not open /dev/mem");
 
 	dev.io = mmap(0, dev.size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, dev.base);
-	if (!dev.io) {
+	if (dev.io == MAP_FAILED) {
 		close(fd);
 		err(1, "could not map device");
 	}



More information about the mesa-commit mailing list