lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:   Fri, 29 Jul 2022 18:03:07 +0900
From:   Vincent Mailhol <mailhol.vincent@...adoo.fr>
To:     Marc Zyngier <maz@...nel.org>, linux-kernel@...r.kernel.org
Cc:     Vincent Mailhol <mailhol.vincent@...adoo.fr>
Subject: [PATCH] irqdomain: do not shadow nr_irqs global definition

include/linux/irqnr.h declares a global variable named `nr_irqs'.

The inline function irq_domain_alloc_irqs() from
include/linux/irqdomain.h also uses the same name and thus shadow the
global declaration. Rename the function argument from `nr_irqs' to
`nbr_irqs'.

This patch silences below -Wshadow warning:

| In file included from ./arch/x86/include/asm/irqdomain.h:5,
|                  from ./arch/x86/include/asm/msi.h:5,
|                  from ./include/linux/msi.h:23,
|                  from ./include/linux/kvm_host.h:19,
|                  from arch/x86/kernel/../kvm/vmx/vmx.h:5,
|                  from arch/x86/kernel/asm-offsets.c:22:
| ./include/linux/irqdomain.h: In function 'irq_domain_alloc_irqs':
| ./include/linux/irqdomain.h:514:38: warning: declaration of 'nr_irqs' shadows a global declaration [-Wshadow]
|   514 |                         unsigned int nr_irqs, int node, void *arg)
|       |                         ~~~~~~~~~~~~~^~~~~~~
| In file included from ./include/linux/interrupt.h:10,
|                  from ./include/linux/kernel_stat.h:9,
|                  from ./include/linux/cgroup.h:26,
|                  from ./include/linux/memcontrol.h:13,
|                  from ./include/linux/swap.h:9,
|                  from ./include/linux/suspend.h:5,
|                  from arch/x86/kernel/asm-offsets.c:13:
| ./include/linux/irqnr.h:8:12: note: shadowed declaration is here
|     8 | extern int nr_irqs;
|       |            ^~~~~~~

Signed-off-by: Vincent Mailhol <mailhol.vincent@...adoo.fr>
---
 include/linux/irqdomain.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/linux/irqdomain.h b/include/linux/irqdomain.h
index 00d577f90883..76949bb029b0 100644
--- a/include/linux/irqdomain.h
+++ b/include/linux/irqdomain.h
@@ -511,9 +511,9 @@ extern int irq_domain_activate_irq(struct irq_data *irq_data, bool early);
 extern void irq_domain_deactivate_irq(struct irq_data *irq_data);
 
 static inline int irq_domain_alloc_irqs(struct irq_domain *domain,
-			unsigned int nr_irqs, int node, void *arg)
+					unsigned int nbr_irqs, int node, void *arg)
 {
-	return __irq_domain_alloc_irqs(domain, -1, nr_irqs, node, arg, false,
+	return __irq_domain_alloc_irqs(domain, -1, nbr_irqs, node, arg, false,
 				       NULL);
 }
 
-- 
2.35.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ