On 21.09.2026 10:53, Roger Pau Monné wrote:
> On Thu, Sep 03, 2026 at 01:51:28PM +0200, Jan Beulich wrote:
>> Compound literals are also covered by Misra C:2012 rule 13.1
>> ("Initializer lists shall not contain persistent side effects"), and
>> (sadly?) that rule also applies to lists with just a single element, or
>> more generally with just a single side effect. Use intermediate variables
>> to overcome this as well as ACCESS_ONCE()'s restriction to be usable on
>> scalar types only.
>>
>> No functional change intended.
>>
>> Fixes: 0345b835dc97 ("x86/pagewalk: Read guest PTEs with ACCESS_ONCE()")
>> Signed-off-by: Jan Beulich <[email protected]>
>>
>> --- a/xen/arch/x86/mm/guest_walk.c
>> +++ b/xen/arch/x86/mm/guest_walk.c
>> @@ -129,7 +129,9 @@ guest_walk_tables(const struct vcpu *v,
>> guest_l4_table_offset(va) * sizeof(gw->l4e);
>> if ( !hvmemul_read_cache(v, l4gpa, &gw->l4e, sizeof(gw->l4e)) )
>> {
>> - gw->l4e = (guest_l4e_t){
>> ACCESS_ONCE(l4p[guest_l4_table_offset(va)].l4) };
>> + guest_intpte_t l4e = ACCESS_ONCE(l4p[guest_l4_table_offset(va)].l4);
>> +
>> + gw->l4e = (guest_l4e_t){ l4e };
>
> Did you consider using the l4e_from_intpte() and similar helpers here
> and below?
No, I didn't, as they aren't applicable to guest_l<N>e_t. guest_intpte_t
aliases intpte_t only for GUEST_PAGING_LEVELS > 2.
Jan