Mesa (main): drm-shim: Explicitly use off64_t for the offset to drm_shim_mmap

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Apr 12 10:32:44 UTC 2022


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

Author: Icecream95 <ixn at disroot.org>
Date:   Mon Sep  6 19:44:23 2021 +1200

drm-shim: Explicitly use off64_t for the offset to drm_shim_mmap

drm_shim.c undefines the _FILE_OFFSET_BITS macro, so plain off_t might
be 32 bits, while it's 64 bits in device.c. To avoid this mismatch,
use off64_t which will always be 64 bits in both source files.

Reviewed-by: Emma Anholt <emma at anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12203>

---

 src/drm-shim/device.c   | 2 +-
 src/drm-shim/drm_shim.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/drm-shim/device.c b/src/drm-shim/device.c
index 211eb2e5781..fecdb1fcd21 100644
--- a/src/drm-shim/device.c
+++ b/src/drm-shim/device.c
@@ -373,7 +373,7 @@ drm_shim_bo_get_mmap_offset(struct shim_fd *shim_fd, struct shim_bo *bo)
  */
 void *
 drm_shim_mmap(struct shim_fd *shim_fd, size_t length, int prot, int flags,
-              int fd, off_t offset)
+              int fd, off64_t offset)
 {
    struct shim_bo *bo = (void *)(uintptr_t)offset;
 
diff --git a/src/drm-shim/drm_shim.h b/src/drm-shim/drm_shim.h
index cb3951afa82..dbb831747da 100644
--- a/src/drm-shim/drm_shim.h
+++ b/src/drm-shim/drm_shim.h
@@ -83,7 +83,7 @@ void drm_shim_fd_register(int fd, struct shim_fd *shim_fd);
 struct shim_fd *drm_shim_fd_lookup(int fd);
 int drm_shim_ioctl(int fd, unsigned long request, void *arg);
 void *drm_shim_mmap(struct shim_fd *shim_fd, size_t length, int prot, int flags,
-                    int fd, off_t offset);
+                    int fd, off64_t offset);
 
 void drm_shim_bo_init(struct shim_bo *bo, size_t size);
 void drm_shim_bo_get(struct shim_bo *bo);



More information about the mesa-commit mailing list