From 91ea85ec1213bf3dbc052bd8b3710f9be7a71000 Mon Sep 17 00:00:00 2001 From: Jan Beulich Date: Fri, 22 May 2026 08:19:34 +0200 Subject: [PATCH] x86/P2M: split a read_atomic() invocation Misra C:2012 rule 13.6 takes issue with pfn_to_pdx() and mfn_x() uses (deep) inside sizeof(), as used by read_atomic(). Break out the MFN -> struct page_info * translation. No difference in generated code, except for a line number change. Signed-off-by: Jan Beulich Reviewed-by: Andrew Cooper --- xen/arch/x86/mm/p2m.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/xen/arch/x86/mm/p2m.c b/xen/arch/x86/mm/p2m.c index f5f9c0ac45..027b9ae69b 100644 --- a/xen/arch/x86/mm/p2m.c +++ b/xen/arch/x86/mm/p2m.c @@ -1332,6 +1332,7 @@ int set_shared_p2m_entry(struct domain *d, unsigned long gfn_l, mfn_t mfn) p2m_access_t a; p2m_type_t ot; mfn_t omfn; + const struct page_info *pg; unsigned long pg_type; if ( !paging_mode_translate(p2m->domain) ) @@ -1345,7 +1346,8 @@ int set_shared_p2m_entry(struct domain *d, unsigned long gfn_l, mfn_t mfn) ASSERT(mfn_valid(omfn)); /* Set the m2p entry to invalid only if there are no further type * refs to this page as shared */ - pg_type = read_atomic(&(mfn_to_page(omfn)->u.inuse.type_info)); + pg = mfn_to_page(omfn); + pg_type = read_atomic(&pg->u.inuse.type_info); if ( (pg_type & PGT_count_mask) == 0 || (pg_type & PGT_type_mask) != PGT_shared_page ) set_gpfn_from_mfn(mfn_x(omfn), INVALID_M2P_ENTRY);