[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[xen master] x86/shadow: replace bogus return path in shadow_get_page_from_l1e()



commit 4834936549f788378918da8e9bc97df7dd3ee16d
Author:     Jan Beulich <jbeulich@xxxxxxxx>
AuthorDate: Tue Mar 2 12:30:30 2021 +0100
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Tue Mar 2 12:30:30 2021 +0100

    x86/shadow: replace bogus return path in shadow_get_page_from_l1e()
    
    Prior to be640b1800bb ("x86: make get_page_from_l1e() return a proper
    error code") a positive return value did indicate an error. Said commit
    failed to adjust this return path, but luckily the only caller has
    always been inside a shadow_mode_refcounts() conditional.
    
    Subsequent changes caused 1 to end up at the default (error) label in
    the caller's switch() again, but the returning of 1 (== _PAGE_PRESENT)
    is still rather confusing here, and a latent risk.
    
    Convert to an ASSERT() instead, just in case any new caller would
    appear.
    
    Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
    Reviewed-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
    Acked-by: Tim Deegan <tim@xxxxxxx>
    Release-Acked-by: Ian Jackson <iwj@xxxxxxxxxxxxxx>
---
 xen/arch/x86/mm/shadow/multi.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/xen/arch/x86/mm/shadow/multi.c b/xen/arch/x86/mm/shadow/multi.c
index 797ebde586..dd59bec2c3 100644
--- a/xen/arch/x86/mm/shadow/multi.c
+++ b/xen/arch/x86/mm/shadow/multi.c
@@ -802,9 +802,7 @@ shadow_get_page_from_l1e(shadow_l1e_t sl1e, struct domain 
*d, p2m_type_t type)
     struct domain *owner;
 
     ASSERT(!sh_l1e_is_magic(sl1e));
-
-    if ( !shadow_mode_refcounts(d) )
-        return 1;
+    ASSERT(shadow_mode_refcounts(d));
 
     res = get_page_from_l1e(sl1e, d, d);
 
--
generated by git-patchbot for /home/xen/git/xen.git#master



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.