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

[PATCH 1/2] libxl: avoid shadowing of index()


  • To: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Thu, 3 Aug 2023 16:14:37 +0200
  • 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=obCL3PCbJvdo09qNGQHUZs/QI2sBpH+PLePc5+Lcf4A=; b=F4pOvQwExrI7HTobvqoASa+gBHzt0fnxcFxySBveCjFr+JmndqGavYVJYr8f5jVja55kEXH8ylDBzJfCrqqfntUGt1A4cwJa8MHxW43b7QvGHn7TgVqTNbi9KS4DdlWvfLaueMY2HT5kz1IYgnAc3RSdac7hPKotaGYlRAPBDo/504XHiwTaG0Mon049KcC/gW5XxcNWU1RqypC0R5oTmcphre2JfqiC2/8OlEpLZ8qKOuR8b8slps6AKFd9DPIAz3/EXm3FXZkVBQyZm5eo0tcqayg7X0SCUpr6u7OWdBZJNyN+K2JQYsnMnq9s1qG7AtpWzH7j+lbLdmpB/YMIkA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GwNT9JX8K3CRQToDzYxMD9EadIOu/g5BF6Bm0WuNBEdBOcNYyNt2ymIhdB5J37/pIuncLk9dfFTwNtRGakqARelboufr+l8oMtNssJSl8fjL8XJgUCX96A29WnsI+yYi5ngNlesk1MFkkVXVXa55MmbCNfDz9b5B6V7JyKlKGxnt8daWgN4vhj8Xxnvh/kYqzW2kIQdjO6hD3g/39YW0N9TN2XSSl+ELszDb69ruDzLBNDOr2h1OYOEf4nwhNBbG9I/8417vcdNoT1cPFPgouD56AQ4Iba3jZmxqwAJqZncNWr1FYSSu9JwFaJe4jsPbPQqvuw77LbmQdWIMRgXZLA==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Anthony Perard <anthony.perard@xxxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Juergen Gross <jgross@xxxxxxxx>
  • Delivery-date: Thu, 03 Aug 2023 14:14:45 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

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>

--- a/tools/libs/light/libxl_cpuid.c
+++ b/tools/libs/light/libxl_cpuid.c
@@ -157,7 +157,7 @@ static int cpuid_add(libxl_cpuid_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(lib
 
     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(lib
     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)




 


Rackspace

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