Mesa (master): intel/compiler: Return early if read() failed

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Jan 22 21:16:27 UTC 2020


Module: Mesa
Branch: master
Commit: 5f78524d9b5c579d492470ebd635178339a551a6
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=5f78524d9b5c579d492470ebd635178339a551a6

Author: Emmanuel Gil Peyrot <linkmauve at linkmauve.fr>
Date:   Wed Nov 20 16:21:42 2019 +0100

intel/compiler: Return early if read() failed

This was the only warning I could see while compiling Iris.

Reviewed-by: Matt Turner <mattst88 at gmail.com>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/2821>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/2821>

---

 src/intel/compiler/brw_eu.cpp | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/intel/compiler/brw_eu.cpp b/src/intel/compiler/brw_eu.cpp
index 4ce36fc2597..16600bdc537 100644
--- a/src/intel/compiler/brw_eu.cpp
+++ b/src/intel/compiler/brw_eu.cpp
@@ -394,8 +394,11 @@ 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);
 
-   read(fd, p->store + start_offset, sb.st_size);
+   ssize_t ret = read(fd, p->store + start_offset, sb.st_size);
    close(fd);
+   if (ret != sb.st_size) {
+      return false;
+   }
 
    ASSERTED bool valid =
       brw_validate_instructions(p->devinfo, p->store,



More information about the mesa-commit mailing list