[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [xen master] Argo: drop meaningless mfn_valid() check
commit 9bb281d328cb7c6319f44897a2c29909eeb8674b Author: Jan Beulich <jbeulich@xxxxxxxx> AuthorDate: Wed Feb 14 10:38:38 2024 +0100 Commit: Jan Beulich <jbeulich@xxxxxxxx> CommitDate: Wed Feb 14 10:38:38 2024 +0100 Argo: drop meaningless mfn_valid() check Holding a valid struct page_info * in hands already means the referenced MFN is valid; there's no need to check that again. Convert the checking logic to a switch(), to help keeping the extra (and questionable) x86- only check in somewhat tidy shape. Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx> Reviewed-by: Christopher Clark <christopher.w.clark@xxxxxxxxx> --- xen/common/argo.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/xen/common/argo.c b/xen/common/argo.c index f29fa720fc..5dc5e45c7b 100644 --- a/xen/common/argo.c +++ b/xen/common/argo.c @@ -1421,15 +1421,24 @@ find_ring_mfn(struct domain *d, gfn_t gfn, mfn_t *mfn) return ret; *mfn = page_to_mfn(page); - if ( !mfn_valid(*mfn) ) - ret = -EINVAL; + + switch ( p2mt ) + { + case p2m_ram_rw: + if ( !get_page_and_type(page, d, PGT_writable_page) ) + ret = -EINVAL; + break; + #ifdef CONFIG_X86 - else if ( p2mt == p2m_ram_logdirty ) + case p2m_ram_logdirty: ret = -EAGAIN; + break; #endif - else if ( (p2mt != p2m_ram_rw) || - !get_page_and_type(page, d, PGT_writable_page) ) + + default: ret = -EINVAL; + break; + } put_page(page); -- generated by git-patchbot for /home/xen/git/xen.git#master
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |