diff options
author | Flavio Cruz <flaviocruz@gmail.com> | 2015-12-29 17:31:30 +0100 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2015-12-29 20:47:40 +0100 |
commit | b4cf10f408d50e4caaeda6d2bc9df2db3398a9cd (patch) | |
tree | 37a51e9774ee69a4911f015bcc20564e8d0279ec | |
parent | 52b5c7e8db6e6742dd6d7bf1548c6d33e149f59a (diff) |
boot: Fix boot.c compiler warning.
* boot/boot.c: Compare header without using pointer dereferencing.
-rw-r--r-- | boot/boot.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/boot/boot.c b/boot/boot.c index f6888606..4dda26b7 100644 --- a/boot/boot.c +++ b/boot/boot.c @@ -243,7 +243,9 @@ load_image (task_t t, } read (fd, &hdr, sizeof hdr); - if (*(Elf32_Word *) hdr.e.e_ident == *(Elf32_Word *) "\177ELF") + /* File must have magic ELF number. */ + if (hdr.e.e_ident[0] == 0177 && hdr.e.e_ident[1] == 'E' && + hdr.e.e_ident[2] == 'L' && hdr.e.e_ident[3] == 'F') { Elf32_Phdr phdrs[hdr.e.e_phnum], *ph; lseek (fd, hdr.e.e_phoff, SEEK_SET); |