Mesa (master): Properly check mmap return value

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri May 22 17:48:15 UTC 2020


Module: Mesa
Branch: master
Commit: be71e2fd08b364f331a7e44d34f67954f0aeebe3
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=be71e2fd08b364f331a7e44d34f67954f0aeebe3

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>

---

 src/freedreno/perfcntrs/fdperf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/freedreno/perfcntrs/fdperf.c b/src/freedreno/perfcntrs/fdperf.c
index cc5e90c39d9..976f6ee77bb 100644
--- a/src/freedreno/perfcntrs/fdperf.c
+++ b/src/freedreno/perfcntrs/fdperf.c
@@ -332,7 +332,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