linux-user: Check dump_write() return in elf_core_dump()
authorPeter Maydell <peter.maydell@linaro.org>
Tue, 12 Jul 2016 12:02:17 +0000 (13:02 +0100)
committerRiku Voipio <riku.voipio@linaro.org>
Wed, 21 Sep 2016 11:28:03 +0000 (14:28 +0300)
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

index e9a3882bef9267c506a67d360081ae6c2333667c..0d07b85cb8fbe59e5fcebeddb07e81ae7f880425 100644 (file)
@@ -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;
+        }
     }
 
     /*