diff --git a/src/panfrost/clc/pan_compile.c b/src/panfrost/clc/pan_compile.c index b80546aaefe..6f88ea9544e 100644 --- a/src/panfrost/clc/pan_compile.c +++ b/src/panfrost/clc/pan_compile.c @@ -285,6 +285,13 @@ main(int argc, const char **argv) } off_t spirv_len = lseek(fd, 0, SEEK_END); + if (spirv_len < 0) { + fprintf(stderr, "Failed to lseek to the end of the file: errno=%d, %s\n", + errno, strerror(errno)); + close(fd); + goto input_spirv_open_failed; + } + const void *spirv_map = mmap(NULL, spirv_len, PROT_READ, MAP_PRIVATE, fd, 0); close(fd);