aboutsummaryrefslogtreecommitdiff
path: root/include/hw/elf_ops.h
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2015-03-19 14:10:20 +0000
committerPeter Maydell <peter.maydell@linaro.org>2015-03-19 14:10:20 +0000
commit7a9a5e72e8a62395649a46c53c3c224cc73ca52f (patch)
treea90264b150c50d8183b0674607f40e23d62ccf27 /include/hw/elf_ops.h
parentd88aec88cdd2cdb1939b88a8cdab0a5da3c4559b (diff)
parent8ce1ee4618f4a557959f5a5731f6726b30416df5 (diff)
Merge remote-tracking branch 'remotes/mjt/tags/pull-trivial-patches-2015-03-19' into staging
trivial patches for 2015-03-19 # gpg: Signature made Thu Mar 19 08:57:54 2015 GMT using RSA key ID A4C3D7DB # gpg: Good signature from "Michael Tokarev <mjt@tls.msk.ru>" # gpg: aka "Michael Tokarev <mjt@corpit.ru>" # gpg: aka "Michael Tokarev <mjt@debian.org>" * remotes/mjt/tags/pull-trivial-patches-2015-03-19: (24 commits) qga/commands-posix: Fix resource leak elf-loader: Add missing error handling for call of lseek elf-loader: Fix truncation warning from coverity hmp: Fix texinfo documentation Fix typos in comments qtest/ahci: Fix a bit mask expression vl: fix resource leak with monitor_fdset_add_fd smbios: add max speed comdline option for type-17 (meory device) structure pc-dimm: Add description for device list. configure: enable kvm on x32 error: Replace error_report() & error_free() with error_report_err() arm: fix memory leak qmp: Drop unused .user_print from command definitions hmp: Fix definition of command quit target-moxie: Fix warnings from Sparse (one-bit signed bitfield) block/qapi: Fix Sparse warning Fix remaining warnings from Sparse (void return) qom: Fix warning from Sparse target-mips: Fix warning from Sparse arm/nseries: Fix warnings from Sparse ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'include/hw/elf_ops.h')
-rw-r--r--include/hw/elf_ops.h4
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;