In ept_p2m_type_to_flags() passing in type and access as separate
parameters can be considered an optimization, as all callers set the
respective fields in the entry being updated before the call. Retain
this behavior but add assertions.

Signed-off-by: Jan Beulich <jbeul...@suse.com>

--- a/xen/arch/x86/mm/p2m-ept.c
+++ b/xen/arch/x86/mm/p2m-ept.c
@@ -75,7 +75,8 @@ static void ept_p2m_type_to_flags(struct
      * D bit is set for all writable types in EPT leaf entry, except for
      * log-dirty type with PML.
      */
-    switch(type)
+    ASSERT(type == entry->sa_p2mt);
+    switch ( type )
     {
         case p2m_invalid:
         case p2m_mmio_dm:
@@ -143,9 +144,9 @@ static void ept_p2m_type_to_flags(struct
             break;
     }
 
-
     /* Then restrict with access permissions */
-    switch (access) 
+    ASSERT(access == entry->access);
+    switch ( access )
     {
         case p2m_access_n:
         case p2m_access_n2rwx:

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

Reply via email to