Skip to contentSkip to conversation

xen/shadow: Clean up use of assertions in multi.c

PATCH Applied Andrew Cooper 3 participants 3 messages Apr 16, 2014 – Apr 24, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xen/shadow: Clean up use of assertions in multi.c

Use BUILD_BUG_ON()s in preference to ASSERT(sizeof(foo) == sizeof (bar)).

sh_map_domain_page() is just a thin wrapper around map_domain_page(), which cannot fail. Asserting its success is redundant.

CC Keir Fraser <[email protected]>
CC Jan Beulich <[email protected]>
CC Tim Deegan <[email protected]>
---
 xen/arch/x86/mm/shadow/multi.c |    7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
xen/arch/x86/mm/shadow/multi.c +2 -5
index dc90652..c6c9d10 100644
@@ -804,7 +804,6 @@ shadow_write_entries(void *d, void *s, int entries, mfn_t mfn)
     {
         perfc_incr(shadow_linear_map_failed);
         map = sh_map_domain_page(mfn);
-        ASSERT(map != NULL);
         dst = map + ((unsigned long)dst & (PAGE_SIZE - 1));
     }
 
@@ -1424,8 +1423,7 @@ void sh_install_xen_entries_in_l4(struct vcpu *v, mfn_t gl4mfn, mfn_t sl4mfn)
     unsigned int slots;
 
     sl4e = sh_map_domain_page(sl4mfn);
-    ASSERT(sl4e != NULL);
-    ASSERT(sizeof (l4_pgentry_t) == sizeof (shadow_l4e_t));
+    BUILD_BUG_ON(sizeof (l4_pgentry_t) != sizeof (shadow_l4e_t));
     
     /* Copy the common Xen mappings from the idle domain */
     slots = (shadow_mode_external(d)
@@ -1478,8 +1476,7 @@ static void sh_install_xen_entries_in_l2h(struct vcpu *v, mfn_t sl2hmfn)
         return;
 
     sl2e = sh_map_domain_page(sl2hmfn);
-    ASSERT(sl2e != NULL);
-    ASSERT(sizeof (l2_pgentry_t) == sizeof (shadow_l2e_t));
+    BUILD_BUG_ON(sizeof (l2_pgentry_t) != sizeof (shadow_l2e_t));
 
     /* Copy the common Xen mappings from the idle domain */
     memcpy(
Signature · 1 line
1.7.10.4