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

[xen stable-4.14] libxl: avoid shadowing of index()



commit 26a5e35fd81ac97ff9b49bfaf932f67aa2a26e76
Author:     Jan Beulich <jbeulich@xxxxxxxx>
AuthorDate: Thu Aug 3 17:35:26 2023 +0200
Commit:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
CommitDate: Thu Aug 3 19:14:19 2023 +0100

    libxl: avoid shadowing of index()
    
    Because of -Wshadow the build otherwise fails with old enough glibc.
    
    While there also obey line length limits for msr_add().
    
    Fixes: 6d21cedbaa34 ("libxl: add support for parsing MSR features")
    Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
    Reviewed-by: Juergen Gross <jgross@xxxxxxxx>
    Acked-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
    (cherry picked from commit 4f6afde88be3e8960eb311d16ac41d44ab71ed10)
---
 tools/libxl/libxl_cpuid.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/tools/libxl/libxl_cpuid.c b/tools/libxl/libxl_cpuid.c
index 0a1ff02031..80d83f3213 100644
--- a/tools/libxl/libxl_cpuid.c
+++ b/tools/libxl/libxl_cpuid.c
@@ -157,7 +157,7 @@ static int cpuid_add(libxl_cpuid_policy_list *policy,
     return 0;
 }
 
-static struct xc_msr *msr_find_match(libxl_cpuid_policy_list *pl, uint32_t 
index)
+static struct xc_msr *msr_find_match(libxl_cpuid_policy_list *pl, uint32_t idx)
 {
     unsigned int i = 0;
     libxl_cpuid_policy_list policy = *pl;
@@ -167,14 +167,14 @@ static struct xc_msr 
*msr_find_match(libxl_cpuid_policy_list *pl, uint32_t index
 
     if (policy->msr != NULL) {
         for (i = 0; policy->msr[i].index != XC_MSR_INPUT_UNUSED; i++) {
-            if (policy->msr[i].index == index) {
+            if (policy->msr[i].index == idx) {
                 return &policy->msr[i];
             }
         }
     }
 
     policy->msr = realloc(policy->msr, sizeof(struct xc_msr) * (i + 2));
-    policy->msr[i].index = index;
+    policy->msr[i].index = idx;
     memset(policy->msr[i].policy, 'x', ARRAY_SIZE(policy->msr[0].policy) - 1);
     policy->msr[i].policy[ARRAY_SIZE(policy->msr[0].policy) - 1] = '\0';
     policy->msr[i + 1].index = XC_MSR_INPUT_UNUSED;
@@ -182,10 +182,10 @@ static struct xc_msr 
*msr_find_match(libxl_cpuid_policy_list *pl, uint32_t index
     return &policy->msr[i];
 }
 
-static int msr_add(libxl_cpuid_policy_list *policy, uint32_t index, unsigned 
int bit,
-                   const char *val)
+static int msr_add(libxl_cpuid_policy_list *policy, uint32_t idx,
+                   unsigned int bit, const char *val)
 {
-    struct xc_msr *entry = msr_find_match(policy, index);
+    struct xc_msr *entry = msr_find_match(policy, idx);
 
     /* Only allow options taking a character for MSRs, no values allowed. */
     if (strlen(val) != 1)
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.14



 


Rackspace

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