[2/3] amd: Check return value from ac_elf_read

Submitted by Jan Vesely on June 4, 2019, 2:39 a.m.

Details

Message ID 20190604023917.9194-2-jan.vesely@rutgers.edu
State New
Headers show
Series "Series without cover letter" ( rev: 2 1 ) in Mesa

Not browsing as part of any series.

Commit Message

Jan Vesely June 4, 2019, 2:39 a.m.
Cc: mesa-stable@lists.freedesktop.org
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
---
 src/gallium/drivers/radeonsi/si_compute.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Patch hide | download patch | download mbox

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);