x86/PoD: correct ordering of checks in p2m_pod_zero_check()
authorJan Beulich <jbeulich@suse.com>
Wed, 8 Apr 2020 11:12:28 +0000 (13:12 +0200)
committerJan Beulich <jbeulich@suse.com>
Wed, 8 Apr 2020 11:12:28 +0000 (13:12 +0200)
commit9be0b2747bc7381c684cfbdd3fa2e40badefbeef
tree60d26b538396218486570ea36ca08284fd0018b6
parentd3ff3e48db4a59d1972bcdeb08cac22048d14b27
x86/PoD: correct ordering of checks in p2m_pod_zero_check()

Commit 0537d246f8db ("mm: add 'is_special_page' inline function...")
moved the is_special_page() checks first in its respective changes to
PoD code. While this is fine for p2m_pod_zero_check_superpage(), the
validity of the MFN is inferred in both cases from the p2m_is_ram()
check, which therefore also needs to come first in this 2nd instance.

Take the opportunity and address latent UB here as well - transform
the MFN into struct page_info * only after having established that
this is a valid page.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Paul Durrant <paul@xen.org>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
xen/arch/x86/mm/p2m-pod.c