From: Stefan Weil Date: Sat, 14 Mar 2015 15:42:01 +0000 (+0100) Subject: elf-loader: Add missing error handling for call of lseek X-Git-Tag: v2.3.0-rc1~9^2~1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=23bf2e76806390bf12798c2234a23c5c8a15c35d;p=thirdparty%2Fqemu.git elf-loader: Add missing error handling for call of lseek This fixes a warning from Coverity. Signed-off-by: Stefan Weil Reviewed-by: Thomas Huth Signed-off-by: Michael Tokarev --- diff --git a/include/hw/elf_ops.h b/include/hw/elf_ops.h index 16a627bdeb9..bd719681437 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;