Mesa (main): freedreno/drm-shim: Robustify error handling

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon May 2 20:19:56 UTC 2022


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

Author: Rob Clark <robdclark at chromium.org>
Date:   Wed Apr 27 16:16:27 2022 -0700

freedreno/drm-shim: Robustify error handling

We can't be so sloppy if we are using drm-shim for fuzzing.

Signed-off-by: Rob Clark <robdclark at chromium.org>
Reviewed-by: Emma Anholt <emma at anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16250>

---

 src/freedreno/drm-shim/freedreno_noop.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/freedreno/drm-shim/freedreno_noop.c b/src/freedreno/drm-shim/freedreno_noop.c
index c6cea35c4b6..c48ff76fad8 100644
--- a/src/freedreno/drm-shim/freedreno_noop.c
+++ b/src/freedreno/drm-shim/freedreno_noop.c
@@ -94,6 +94,9 @@ msm_ioctl_gem_info(int fd, unsigned long request, void *arg)
    struct drm_msm_gem_info *args = arg;
    struct shim_bo *bo = drm_shim_bo_lookup(shim_fd, args->handle);
 
+   if (!bo)
+      return -ENOENT;
+
    switch (args->info) {
    case MSM_INFO_GET_OFFSET:
       args->value = drm_shim_bo_get_mmap_offset(shim_fd, bo);



More information about the mesa-commit mailing list