grub-devel
[Top][All Lists]
Advanced

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

Re: Multiboot 2 Header Alignment: implementation contradicts specificati


From: Jacob Paul
Subject: Re: Multiboot 2 Header Alignment: implementation contradicts specification
Date: Sat, 23 May 2020 21:24:32 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.8.0

On 2020-05-23 20:33, Hans Ulrich Niedermann wrote:
The comment is valid for MB1, but not for MB2. Both regarding the
alignment and regarding the size. And regarding the size, this actually
means there is a bug in the code here: An MB2 header is at least 16
bytes for the header magic plus at least 8 bytes for the mb2 header
termination tag. That adds up to 24 bytes for MB2, not 12 bytes as it
did for MB1.

I see, so there is at least that. Might be a good idea to fix it.

I fear you have missed that bytes and grub_uint32_t array elements are
not the same size.

I unfortunately did not notice the (grub_uint32_t *), I apologize for assuming that it increments by 2 bytes and not u32's. Wouldn't it be a lot cleaner if it just incremented it in bytes instead, since you could then also remove the division by 4 and the cast? It wouldn't make any difference runtime wise, just a bit easier to read.

Jacob








reply via email to

[Prev in Thread] Current Thread [Next in Thread]