[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [xen staging] common: map_vcpu_info() cosmetics
commit 7ee7a3749bcb5d39ced5a1ee3e8284b2bb9abc29 Author: Jan Beulich <jbeulich@xxxxxxxx> AuthorDate: Tue Apr 6 16:17:42 2021 +0200 Commit: Jan Beulich <jbeulich@xxxxxxxx> CommitDate: Tue Apr 6 16:17:42 2021 +0200 common: map_vcpu_info() cosmetics Use ENXIO instead of EINVAL to cover the two cases of the address not satisfying the requirements. This will make an issue here better stand out at the call site. Also add a missing compat-mode related size check: If the sizes differed, other code in the function would need changing. Accompany this by a change to the initial sizeof() expression, tying it to the type of the variable we're actually after (matching e.g. the alignof() added by XSA-327). Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx> Reviewed-by: Roger Pau Monné <roger.pau@xxxxxxxxxx> Acked-by: Julien Grall <jgrall@xxxxxxxxxx> --- xen/common/domain.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/xen/common/domain.c b/xen/common/domain.c index d85984638a..cdda0d1f29 100644 --- a/xen/common/domain.c +++ b/xen/common/domain.c @@ -1427,17 +1427,18 @@ int map_vcpu_info(struct vcpu *v, unsigned long gfn, unsigned offset) struct page_info *page; unsigned int align; - if ( offset > (PAGE_SIZE - sizeof(vcpu_info_t)) ) - return -EINVAL; + if ( offset > (PAGE_SIZE - sizeof(*new_info)) ) + return -ENXIO; #ifdef CONFIG_COMPAT + BUILD_BUG_ON(sizeof(*new_info) != sizeof(new_info->compat)); if ( has_32bit_shinfo(d) ) align = alignof(new_info->compat); else #endif align = alignof(*new_info); if ( offset & (align - 1) ) - return -EINVAL; + return -ENXIO; if ( !mfn_eq(v->vcpu_info_mfn, INVALID_MFN) ) return -EINVAL; -- generated by git-patchbot for /home/xen/git/xen.git#staging
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |