ArmPkg/ArmMmuLib ARM: handle unmapped section in GetMemoryRegion()
authorArd Biesheuvel <ard.biesheuvel@linaro.org>
Fri, 30 Nov 2018 11:28:26 +0000 (12:28 +0100)
committerArd Biesheuvel <ard.biesheuvel@linaro.org>
Mon, 3 Dec 2018 14:54:39 +0000 (15:54 +0100)
commit36a87fec6879b4bd96de88a7234f9a98c69af8e1
tree0f14ee0816c47804d51e40dab33fee8327c6c738
parenta2df8587bf7a4f3da37d7a906ca66d65d293665d
ArmPkg/ArmMmuLib ARM: handle unmapped section in GetMemoryRegion()

GetMemoryRegion() is used to obtain the attributes of an existing
mapping, to permit permission attribute changes to be optimized
away if the attributes don't actually change.

The current ARM code assumes that a section mapping or a page mapping
exists for any region passed into GetMemoryRegion(), but the region
may be unmapped entirely, in which case the code will crash. So check
if a section mapping exists before dereferencing it.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
ArmPkg/Drivers/CpuDxe/Arm/Mmu.c