elf.c: correct the Multiboot checksum algorithms
authorH. Peter Anvin <hpa@zytor.com>
Thu, 27 May 2010 13:54:30 +0000 (06:54 -0700)
committerH. Peter Anvin <hpa@zytor.com>
Thu, 27 May 2010 13:59:28 +0000 (06:59 -0700)
commit919aad7b6cd4568b5c018d6b1f606e027a2d8a82
treeb4d988b6736558d1eb1f3572b35773be30a53d6d
parent1950e080c9e7de1e7681b407bbb225bc593a1464
elf.c: correct the Multiboot checksum algorithms

The Multiboot checksum *only* applies to the "magic" and "flags"
fields, even if other fields in the header are actually used.

Accordingly, open-code the checksum algorithm instead of looping;
looping over two fields is kind of pointless.

Note that since those are the only non-zero fields in the current
header, the existing algorithm does produce the correct result.  This
is therefore a cleanup/future-proofing patch and not a critical bug
fix.

Reported-by: Paul Bolle <pebolle@tiscali.nl>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
elf.c