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

Re: Small bug in arch/i386/boot/pm.c?



hi,

No you can submit the patch.

Thank you for your answer.

John

On Jan 2, 2008 10:51 PM, H. Peter Anvin <hpa@xxxxxxxxx> wrote:
John Smith wrote:
> Hi,
>
> I was looking at this macro in pm.c:
>
> #define GDT_ENTRY(flags,base,limit)             \
>         (((u64)(base & 0xff000000) << 32) |     \
>          ((u64)flags << 40) |                   \
>          ((u64)(limit & 0x00ff0000) << 32) |    \
>          ((u64)(base & 0x00ffff00) << 16) |     \
>          ((u64)(limit & 0x0000ffff)))
>
> I think it should be:
>
> #define GDT_ENTRY(flags,base,limit)             \
>         (((u64)(base & 0xff000000) << 32) |     \
>          ((u64)flags << 40) |                   \
>          ((u64)(limit & 0x00ff0000) << 32) |    \
>          ((u64)(base & 0x00ffffff) << 16) |     \ <----------
>          ((u64)(limit & 0x0000ffff)))
>
> The base is 0 in the code so it's OK but I think that if we use a
> *theoretical* base like 0xffffffff the macro won't set the gdt entry
> correctly.
>
> Did I miss something?
>

Nope, that's absolutely correct (and yes, it's a non-manifest bug.)

Do you want to submit a patch?

       -hpa