From: Jan Beulich Date: Wed, 24 Nov 2021 10:10:36 +0000 (+0100) Subject: x86/Viridian: drop dead variable updates X-Git-Tag: 4.17.0-rc1~1165 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=8c6ea4a78485047ea78f9c07d457a56f5227a08b;p=xen.git x86/Viridian: drop dead variable updates Both hvcall_flush_ex() and hvcall_ipi_ex() update "size" without subsequently using the value; future compilers may warn about such. Alongside dropping the updates, shrink the variables' scopes to demonstrate that there are no outer scope uses. Signed-off-by: Jan Beulich Reviewed-by: Paul Durrant --- diff --git a/xen/arch/x86/hvm/viridian/viridian.c b/xen/arch/x86/hvm/viridian/viridian.c index 7d1cfc530b..efdd60b205 100644 --- a/xen/arch/x86/hvm/viridian/viridian.c +++ b/xen/arch/x86/hvm/viridian/viridian.c @@ -776,7 +776,6 @@ static int hvcall_flush_ex(const union hypercall_input *input, { union hypercall_vpset *vpset = &this_cpu(hypercall_vpset); struct hv_vpset *set = &vpset->set; - size_t size; int rc; *set = input_params.set; @@ -784,8 +783,7 @@ static int hvcall_flush_ex(const union hypercall_input *input, { unsigned long offset = offsetof(typeof(input_params), set.bank_contents); - - size = sizeof(*set->bank_contents) * hv_vpset_nr_banks(set); + size_t size = sizeof(*set->bank_contents) * hv_vpset_nr_banks(set); if ( offsetof(typeof(*vpset), set.bank_contents[0]) + size > sizeof(*vpset) ) @@ -798,11 +796,7 @@ static int hvcall_flush_ex(const union hypercall_input *input, input_params_gpa + offset, size) != HVMTRANS_okay) return -EINVAL; - - size += sizeof(*set); } - else - size = sizeof(*set); rc = hv_vpset_to_vpmask(set, vpmask); if ( rc ) @@ -903,7 +897,6 @@ static int hvcall_ipi_ex(const union hypercall_input *input, } input_params; union hypercall_vpset *vpset = &this_cpu(hypercall_vpset); struct hv_vpset *set = &vpset->set; - size_t size; int rc; /* These hypercalls should never use the fast-call convention. */ @@ -929,8 +922,7 @@ static int hvcall_ipi_ex(const union hypercall_input *input, { unsigned long offset = offsetof(typeof(input_params), set.bank_contents); - - size = sizeof(*set->bank_contents) * hv_vpset_nr_banks(set); + size_t size = sizeof(*set->bank_contents) * hv_vpset_nr_banks(set); if ( offsetof(typeof(*vpset), set.bank_contents[0]) + size > sizeof(*vpset) ) @@ -943,11 +935,7 @@ static int hvcall_ipi_ex(const union hypercall_input *input, input_params_gpa + offset, size) != HVMTRANS_okay) return -EINVAL; - - size += sizeof(*set); } - else - size = sizeof(*set); rc = hv_vpset_to_vpmask(set, vpmask); if ( rc )