Skip to content

Commit

Permalink
x86: EFI: fix use of unitialized variable and the cache logic
Browse files Browse the repository at this point in the history
Andi Kleen pointed out that the cache attribute logic is reverse in
efi_enter_virtual_mode(). This problem alone is harmless as we do not
(yet) do cache attribute conflict resolution. (This bug was not present
in the original EFI submission - I introduced it while fixing up rejects.)

While reviewing this code I noticed a second, worse problem: the use of
uninitialized md->virt_addr.

Fix both problems.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
  • Loading branch information
Thomas Gleixner authored and Ingo Molnar committed Feb 13, 2008
1 parent 5d3c8b2 commit e85f205
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions arch/x86/kernel/efi.c
Original file line number Diff line number Diff line change
Expand Up @@ -428,9 +428,6 @@ void __init efi_enter_virtual_mode(void)
else
va = efi_ioremap(md->phys_addr, size);

if (md->attribute & EFI_MEMORY_WB)
set_memory_uc(md->virt_addr, size);

md->virt_addr = (u64) (unsigned long) va;

if (!va) {
Expand All @@ -439,6 +436,9 @@ void __init efi_enter_virtual_mode(void)
continue;
}

if (!(md->attribute & EFI_MEMORY_WB))
set_memory_uc(md->virt_addr, size);

systab = (u64) (unsigned long) efi_phys.systab;
if (md->phys_addr <= systab && systab < end) {
systab += md->virt_addr - md->phys_addr;
Expand Down

0 comments on commit e85f205

Please sign in to comment.