qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PULL 13/26] linux-user: Check dump_write() return in elf_c


From: riku . voipio
Subject: [Qemu-devel] [PULL 13/26] linux-user: Check dump_write() return in elf_core_dump()
Date: Thu, 22 Sep 2016 15:13:33 +0300

From: Peter Maydell <address@hidden>

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 <address@hidden>
Signed-off-by: Riku Voipio <address@hidden>
---
 linux-user/elfload.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

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;
+        }
     }
 
     /*
-- 
2.1.4




reply via email to

[Prev in Thread] Current Thread [Next in Thread]