diff mbox

[6/8] linux-user: Check dump_write() return in elf_core_dump()

Message ID 1468324939-12221-7-git-send-email-peter.maydell@linaro.org
State New
Headers show

Commit Message

Peter Maydell July 12, 2016, 12:02 p.m. UTC
One of the calls to dump_write() in elf_core_dump() was missing
a check for failure (spotted by Coverity). Add the check to
bring it into line with the other calls from this function.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 linux-user/elfload.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
diff mbox

Patch

diff --git a/linux-user/elfload.c b/linux-user/elfload.c
index 38e210e..7c46cfb 100644
--- a/linux-user/elfload.c
+++ b/linux-user/elfload.c
@@ -3053,7 +3053,9 @@  static int elf_core_dump(int signr, const CPUArchState *env)
         phdr.p_align = ELF_EXEC_PAGESIZE;
 
         bswap_phdr(&phdr, 1);
-        dump_write(fd, &phdr, sizeof (phdr));
+        if (dump_write(fd, &phdr, sizeof(phdr)) != 0) {
+            goto out;
+        }
     }
 
     /*