Use the newly introduced pseek() function when skipping to the start
offset in the ELF file.
The layout of an ELF file should satisfy the constraints of pseek, so
that we should be able to use a pipe file descriptor as well.

Signed-off-by: Andre Przywara <andre.przyw...@arm.com>
---
 mips/kvm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/mips/kvm.c b/mips/kvm.c
index c1c596c..4d08b20 100644
--- a/mips/kvm.c
+++ b/mips/kvm.c
@@ -328,8 +328,8 @@ static bool load_elf_binary(struct kvm *kvm, int fd_kernel)
 
        kvm->arch.entry_point = ei.entry_point;
 
-       if (lseek(fd_kernel, ei.offset, SEEK_SET) < 0)
-               die_perror("lseek");
+       if (!pseek(fd_kernel, ei.offset - sizeof(union ElfHeaders)))
+               die_perror("seek");
 
        p = guest_flat_to_host(kvm, ei.load_addr);
 
-- 
2.3.5

--
To unsubscribe from this list: send the line "unsubscribe kvm-ppc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to