[PATCH 06/14] MIPS: use pseek() in ELF kernel image loading

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.przywara@xxxxxxx>
---
 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

_______________________________________________
kvmarm mailing list
kvmarm@xxxxxxxxxxxxxxxxxxxxx
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm



[Index of Archives]     [Linux KVM]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux