]> xenbits.xensource.com Git - xen.git/commitdiff
xen/shadow: Clean up use of assertions in multi.c
authorAndrew Cooper <andrew.cooper3@citrix.com>
Wed, 16 Apr 2014 18:35:21 +0000 (19:35 +0100)
committerTim Deegan <tim@xen.org>
Thu, 24 Apr 2014 11:38:41 +0000 (12:38 +0100)
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.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Tim Deegan <tim@xen.org>
xen/arch/x86/mm/shadow/multi.c

index dc906522326fa06cc369cc9d5d9816ae463dbcdb..c6c9d10ee2fb0803cc1acd5b9b6998165b752a12 100644 (file)
@@ -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(