[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[xen staging-4.15] x86/Viridian: fix error code use



commit bf3beeeb5a3cdfe0733fc71e848f404f09914a3c
Author:     Jan Beulich <jbeulich@xxxxxxxx>
AuthorDate: Fri Jan 7 08:13:25 2022 +0100
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Fri Jan 7 08:13:25 2022 +0100

    x86/Viridian: fix error code use
    
    Both the wrong use of HV_STATUS_* and the return type of
    hv_vpset_to_vpmask() can lead to viridian_hypercall()'s
    ASSERT_UNREACHABLE() triggering when translating error codes from Xen
    to Viridian representation.
    
    Fixes: b4124682db6e ("viridian: add ExProcessorMasks variants of the flush 
hypercalls")
    Fixes: 9afa867d42ba ("viridian: add ExProcessorMasks variant of the IPI 
hypercall")
    Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
    Reviewed-by: Paul Durrant <paul@xxxxxxx>
    master commit: 857fee77845be0c5c35fd51bac64455369d32a6f
    master date: 2021-11-24 11:09:56 +0100
---
 xen/arch/x86/hvm/viridian/viridian.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/xen/arch/x86/hvm/viridian/viridian.c 
b/xen/arch/x86/hvm/viridian/viridian.c
index b906f7b86a..7d1cfc530b 100644
--- a/xen/arch/x86/hvm/viridian/viridian.c
+++ b/xen/arch/x86/hvm/viridian/viridian.c
@@ -628,8 +628,8 @@ static unsigned int hv_vpset_nr_banks(struct hv_vpset 
*vpset)
     return hweight64(vpset->valid_bank_mask);
 }
 
-static uint16_t hv_vpset_to_vpmask(const struct hv_vpset *set,
-                                   struct hypercall_vpmask *vpmask)
+static int hv_vpset_to_vpmask(const struct hv_vpset *set,
+                              struct hypercall_vpmask *vpmask)
 {
 #define NR_VPS_PER_BANK (HV_VPSET_BANK_SIZE * 8)
 
@@ -919,10 +919,10 @@ static int hvcall_ipi_ex(const union hypercall_input 
*input,
          input_params.reserved_zero[0] ||
          input_params.reserved_zero[1] ||
          input_params.reserved_zero[2] )
-        return HV_STATUS_INVALID_PARAMETER;
+        return -EINVAL;
 
     if ( input_params.vector < 0x10 || input_params.vector > 0xff )
-        return HV_STATUS_INVALID_PARAMETER;
+        return -EINVAL;
 
     *set = input_params.set;
     if ( set->format == HV_GENERIC_SET_SPARSE_4K )
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.15



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.