Properly check mmap return value
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5150>
This commit is contained in:
@@ -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");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user