diff options
author | Stefan Weil <sw@weilnetz.de> | 2015-03-14 16:42:01 +0100 |
---|---|---|
committer | Michael Tokarev <mjt@tls.msk.ru> | 2015-03-19 11:37:40 +0300 |
commit | 23bf2e76806390bf12798c2234a23c5c8a15c35d (patch) | |
tree | df9dedab57e8715505264e72a7a13984dbc6c481 /include/hw/elf_ops.h | |
parent | 6cbfb86f4c0ea7cbe852c7bc62a4ef523887c143 (diff) |
elf-loader: Add missing error handling for call of lseek
This fixes a warning from Coverity.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
Reviewed-by: Thomas Huth <thuth@linux.vnet.ibm.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Diffstat (limited to 'include/hw/elf_ops.h')
-rw-r--r-- | include/hw/elf_ops.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/include/hw/elf_ops.h b/include/hw/elf_ops.h index 16a627bdeb..bd71968143 100644 --- a/include/hw/elf_ops.h +++ b/include/hw/elf_ops.h @@ -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; |