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

[PATCH 2/3] x86/Viridian: drop dead variable updates


  • To: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Thu, 18 Nov 2021 14:14:04 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=a8687ihPanRL+3ac1IjZtotfsNsyk2rdhK4easY+hVg=; b=BlYCAIEf6SP+s1byNcr41bQ9mijij1LvzRzr9xjhokEhsjJ1unyGAbMBIxq89TiBJjlsCI7I7U9qNoBW8LnasBK5H6tKVZ3NmQEVp1iZZz+Aqi/qOtcEgOsJ/1EQjO9kCip/4d6//sKXwfWvUJ5ayN0faXYqD3vfmjP68OYp808wNgVxW8vpAhR/HTCJoT6T5PPzZ3pv7RSQfamAJ/JEdizBAomgylUdf3P8zbjs/wq0aneyQOzRioXiY5kFImZWKCL/UwPyrUbThmfBkPOgUTdttD7MLloGl5DfIDb0TKyqsaB4T2Be31rh64ImMR7f9Mm+okeeTs2n2QYjkT/zNA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Taxmt4IK+K7Z9jpTodVrqmA1byvbF845qHZdtqM/ZE3lTo+JegbsgCtg3esdFdNk1wqrlpZ2M9WYXNBU9rT5h5XrszYPjbPeyX+/K6K20unqepJyIfi9yQohR8QAdLCFaXBK1mlH9z64oTTQjL+zDp7i26uOZSH8FzEuUJqHcrU3LNSfsJYbQh6WJAAm/r6PSQqILL0Szmhvg1hpJ/5lG78GecXmHPuSgIWle6CzCE0OghRmm481ud8JE+ug8cu+mHX51mKIt64q9xDshox519LxEg4B8S6ohd6/Jp7/DHzsyGW1gGKkg7Ei2Z/uqhXGAGVx/jCSlB1rIZ0g0zfAfw==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Paul Durrant <paul@xxxxxxx>, Wei Liu <wl@xxxxxxx>
  • Delivery-date: Thu, 18 Nov 2021 13:14:10 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

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 <jbeulich@xxxxxxxx>

--- 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 h
     {
         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 h
         {
             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 h
                                           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 hyp
     } 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 hyp
     {
         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 hyp
                                       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 )




 


Rackspace

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