Mesa (staging/20.1): intel/compiler: Fix pointer arithmetic when reading shader assembly

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Sep 2 21:01:57 UTC 2020


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

Author: Danylo Piliaiev <danylo.piliaiev at globallogic.com>
Date:   Wed Sep  2 13:37:47 2020 +0300

intel/compiler: Fix pointer arithmetic when reading shader assembly

start_offset is a byte offset.

Fixes: 04a995158084acbd1917b4c7e0f8d381e1c9222d
Signed-off-by: Danylo Piliaiev <danylo.piliaiev at globallogic.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6557>
(cherry picked from commit 87fa645b9438ce7943ae09012f695a7a1bca3eeb)

---

 .pick_status.json             | 2 +-
 src/intel/compiler/brw_eu.cpp | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index 946ac57ade1..bce769c2dd8 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -418,7 +418,7 @@
         "description": "intel/compiler: Fix pointer arithmetic when reading shader assembly",
         "nominated": true,
         "nomination_type": 1,
-        "resolution": 0,
+        "resolution": 1,
         "master_sha": null,
         "because_sha": "04a995158084acbd1917b4c7e0f8d381e1c9222d"
     },
diff --git a/src/intel/compiler/brw_eu.cpp b/src/intel/compiler/brw_eu.cpp
index 78272f27fbf..17b751ad524 100644
--- a/src/intel/compiler/brw_eu.cpp
+++ b/src/intel/compiler/brw_eu.cpp
@@ -394,7 +394,7 @@ bool brw_try_override_assembly(struct brw_codegen *p, int start_offset,
    p->store = (brw_inst *)reralloc_size(p->mem_ctx, p->store, p->next_insn_offset);
    assert(p->store);
 
-   ssize_t ret = read(fd, p->store + start_offset, sb.st_size);
+   ssize_t ret = read(fd, (char *)p->store + start_offset, sb.st_size);
    close(fd);
    if (ret != sb.st_size) {
       return false;



More information about the mesa-commit mailing list