[Mesa-dev] [PATCH 2/3] amd: Check return value from ac_elf_read
Jan Vesely
jan.vesely at rutgers.edu
Tue Jun 4 02:39:16 UTC 2019
Cc: mesa-stable at lists.freedesktop.org
Signed-off-by: Jan Vesely <jan.vesely at rutgers.edu>
---
src/gallium/drivers/radeonsi/si_compute.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/gallium/drivers/radeonsi/si_compute.c b/src/gallium/drivers/radeonsi/si_compute.c
index 51da06fe550..b9cea00eeeb 100644
--- a/src/gallium/drivers/radeonsi/si_compute.c
+++ b/src/gallium/drivers/radeonsi/si_compute.c
@@ -237,7 +237,11 @@ static void *si_create_compute_state(
header = cso->prog;
code = cso->prog + sizeof(struct pipe_llvm_program_header);
- ac_elf_read(code, header->num_bytes, &program->shader.binary);
+ if (!ac_elf_read(code, header->num_bytes, &program->shader.binary)) {
+ fprintf(stderr, "Error: Failed to read shader ELF\n");
+ FREE(program);
+ return NULL;
+ }
if (program->use_code_object_v2) {
const amd_kernel_code_t *code_object =
si_compute_get_code_object(program, 0);
--
2.21.0
More information about the mesa-dev
mailing list