xen/shadow: Clean up use of assertions in multi.c
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.
Signed-off-by Andrew Cooper <[email protected]>
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
@@ -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
Quoted 7 lines
Quoted 1 line
Quoted 1 line · On 16.04.14 at 20:35, <[email protected]> wrote:
Use BUILD_BUG_ON()s in preference to ASSERT(sizeof(foo) == sizeof (bar)).
sh_map_domain_page()is just a thin wrapper aroundmap_domain_page(), which cannot fail. Asserting its success is redundant.Signed-off-by Andrew Cooper <[email protected]>
Reviewed-by Jan Beulich <[email protected]>
Tim Deegan
AppliedQuoted 6 lines · Andrew Cooper
Use BUILD_BUG_ON()s in preference to ASSERT(sizeof(foo) == sizeof (bar)).
sh_map_domain_page()is just a thin wrapper aroundmap_domain_page(), which cannot fail. Asserting its success is redundant.Signed-off-by Andrew Cooper <[email protected]>
Applied, thanks.
Tim.