]> Git Repo - qemu.git/commitdiff
elf-loader: Add missing error handling for call of lseek
authorStefan Weil <[email protected]>
Sat, 14 Mar 2015 15:42:01 +0000 (16:42 +0100)
committerMichael Tokarev <[email protected]>
Thu, 19 Mar 2015 08:37:40 +0000 (11:37 +0300)
This fixes a warning from Coverity.

Signed-off-by: Stefan Weil <[email protected]>
Reviewed-by: Thomas Huth <[email protected]>
Signed-off-by: Michael Tokarev <[email protected]>
include/hw/elf_ops.h

index 16a627bdeb9e78261399290b87908e90389dfef7..bd719681437b1d96a918942f7b6d71dcb8bf0f79 100644 (file)
@@ -315,7 +315,9 @@ static int glue(load_elf, SZ)(const char *name, int fd,
     glue(load_symbols, SZ)(&ehdr, fd, must_swab, clear_lsb);
 
     size = ehdr.e_phnum * sizeof(phdr[0]);
-    lseek(fd, ehdr.e_phoff, SEEK_SET);
+    if (lseek(fd, ehdr.e_phoff, SEEK_SET) != ehdr.e_phoff) {
+        goto fail;
+    }
     phdr = g_malloc0(size);
     if (!phdr)
         goto fail;
This page took 0.026979 seconds and 4 git commands to generate.