diff mbox

[PULL,13/26] linux-user: Check dump_write() return in elf_core_dump()

Message ID 772034b63e9c0caf6c92e31413f2d8df2ee69c88.1474546244.git.riku.voipio@linaro.org
State Accepted
Commit 772034b63e9c0caf6c92e31413f2d8df2ee69c88
Headers show

Commit Message

Riku Voipio Sept. 22, 2016, 12:13 p.m. UTC
From: Peter Maydell <peter.maydell@linaro.org>


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>

Signed-off-by: Riku Voipio <riku.voipio@linaro.org>

---
 linux-user/elfload.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

-- 
2.1.4
diff mbox

Patch

diff --git a/linux-user/elfload.c b/linux-user/elfload.c
index e9a3882..0d07b85 100644
--- a/linux-user/elfload.c
+++ b/linux-user/elfload.c
@@ -3050,7 +3050,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;
+        }
     }
 
     /*