lkml.org 
[lkml]   [1999]   [Oct]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [patch] two patches for your review
On Mon, Oct 11, 1999 at 07:44:42AM +0100, Tigran Aivazian wrote:
> 2. http://www.ocston.org/~tigran/patches/binfmt-2.3.20.patch
>
> A simple optimization for ELF magic check along the lines of:
>
> - if (elf_ex.e_ident[0] != 0x7f ||
> - strncmp(&elf_ex.e_ident[1], "ELF", 3) != 0)
> + if (strncmp(elf_ex.e_ident, ELFMAG, SELFMAG))
>
> (I hope it doesn't break non-intel-endian worlds, but you tell me!)

Ah, Tigran, this is something I was about to send you.. strncmp doesn't
make much sense there; it's not a string after all, it's a 4-byte magic
number:

if (memcmp(elf_ex.e_ident, ELFMAG, SELFMAG) != 0)

makes much more sense. And if this makes a difference on other endian
platforms, why are they doing a memset further down the file in the
core dump routine? :-)

--
Matthew Wilcox <willy@bofh.ai>
"Windows and MacOS are products, contrived by engineers in the service of
specific companies. Unix, by contrast, is not so much a product as it is a
painstakingly compiled oral history of the hacker subculture." - N Stephenson

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:54    [W:0.042 / U:0.012 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site