intel/compiler: Fix pointer arithmetic when reading shader assembly

start_offset is a byte offset.

Fixes: 04a9951580
Signed-off-by: Danylo Piliaiev <danylo.piliaiev@globallogic.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6557>
(cherry picked from commit 87fa645b94)
This commit is contained in:
Danylo Piliaiev 2020-09-02 13:37:47 +03:00 committed by Eric Engestrom
parent 3f55b4c50a
commit 2f6cd0afa2
2 changed files with 2 additions and 2 deletions

View file

@ -3748,7 +3748,7 @@
"description": "intel/compiler: Fix pointer arithmetic when reading shader assembly", "description": "intel/compiler: Fix pointer arithmetic when reading shader assembly",
"nominated": true, "nominated": true,
"nomination_type": 1, "nomination_type": 1,
"resolution": 0, "resolution": 1,
"master_sha": null, "master_sha": null,
"because_sha": "04a995158084acbd1917b4c7e0f8d381e1c9222d" "because_sha": "04a995158084acbd1917b4c7e0f8d381e1c9222d"
}, },

View file

@ -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); p->store = (brw_inst *)reralloc_size(p->mem_ctx, p->store, p->next_insn_offset);
assert(p->store); 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); close(fd);
if (ret != sb.st_size) { if (ret != sb.st_size) {
return false; return false;