On 10.01.2020 18:12, Jan Beulich wrote: > On 08.01.2020 15:08, Alexandru Stefan ISAILA wrote: >> Changes since V6: >> - Remove stray spaces >> - Use ARRAY_SIZE(d->arch.altp2m_p2m) insead of MAX_ALTP2M. > > I'm not utterly confused: > >> --- a/xen/arch/x86/mm/mem_access.c >> +++ b/xen/arch/x86/mm/mem_access.c >> @@ -366,11 +366,13 @@ long p2m_set_mem_access(struct domain *d, gfn_t gfn, >> uint32_t nr, >> #ifdef CONFIG_HVM >> if ( altp2m_idx ) >> { >> - if ( altp2m_idx >= MAX_ALTP2M || >> - d->arch.altp2m_eptp[altp2m_idx] == mfn_x(INVALID_MFN) ) >> + if ( altp2m_idx >= min(ARRAY_SIZE(d->arch.altp2m_p2m), MAX_EPTP) || >> + d->arch.altp2m_eptp[array_index_nospec(altp2m_idx, MAX_EPTP)] >> == >> + mfn_x(INVALID_MFN) ) >> return -EINVAL; >> >> - ap2m = d->arch.altp2m_p2m[altp2m_idx]; >> + ap2m = d->arch.altp2m_p2m[array_index_nospec(altp2m_idx, >> + ARRAY_SIZE(d->arch.altp2m_p2m))]; > > Why is this still not > > ap2m = array_access_nospec(d->arch.altp2m_p2m, altp2m_idx); > > ? What am I missing? >
Sorry for the misunderstanding here, I will use array_access_nospec() where the ARRAY_SIZE(d->arch.altp2m_p2m) is used. Alex _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel