[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <201603081643.6mAzMxzS%fengguang.wu@intel.com>
Date: Tue, 8 Mar 2016 16:38:45 +0800
From: kbuild test robot <fengguang.wu@...el.com>
To: Thomas Gleixner <tglx@...utronix.de>
Cc: kbuild-all@...org, linux-kernel@...r.kernel.org,
Ingo Molnar <mingo@...e.hu>
Subject: kernel/irq/irqdesc.c:206:2: error: array index in initializer
exceeds array bounds
Hi Thomas,
FYI, the error/warning still remains.
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: e2857b8f11a289ed2b61d18d0665e05c1053c446
commit: 3795de236d67a05994a1a12759db9d4dd9ffc42c genirq: Distangle kernel/irq/handle.c
date: 5 years ago
config: m68k-alldefconfig (attached as .config)
reproduce:
wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
git checkout 3795de236d67a05994a1a12759db9d4dd9ffc42c
# save the attached .config to linux build tree
make.cross ARCH=m68k
All errors (new ones prefixed by >>):
In file included from include/linux/irqnr.h:10:0,
from include/linux/irq.h:22,
from kernel/irq/irqdesc.c:10:
arch/m68k/include/asm/irq.h:25:17: error: expected identifier or '(' before numeric constant
#define NR_IRQS 0
^
include/linux/irqnr.h:15:19: note: in expansion of macro 'NR_IRQS'
#define nr_irqs NR_IRQS
^
kernel/irq/irqdesc.c:36:5: note: in expansion of macro 'nr_irqs'
int nr_irqs = NR_IRQS;
^
>> kernel/irq/irqdesc.c:206:2: error: array index in initializer exceeds array bounds
[0 ... NR_IRQS-1] = {
^
kernel/irq/irqdesc.c:206:2: error: (near initialization for 'irq_desc')
kernel/irq/irqdesc.c:208:17: error: 'handle_bad_irq' undeclared here (not in a function)
.handle_irq = handle_bad_irq,
^
kernel/irq/irqdesc.c:211:2: warning: excess elements in array initializer
}
^
kernel/irq/irqdesc.c:211:2: warning: (near initialization for 'irq_desc')
kernel/irq/irqdesc.c: In function 'early_irq_init':
kernel/irq/irqdesc.c:230:28: error: 'no_irq_chip' undeclared (first use in this function)
desc[i].irq_data.chip = &no_irq_chip;
^
kernel/irq/irqdesc.c:230:28: note: each undeclared identifier is reported only once for each function it appears in
In file included from include/linux/irq.h:22:0,
from kernel/irq/irqdesc.c:10:
kernel/irq/irqdesc.c: At top level:
include/linux/irqnr.h:16:27: error: expected identifier or '(' before '&' token
#define irq_to_desc(irq) (&irq_desc[irq])
^
kernel/irq/irqdesc.c:238:18: note: in expansion of macro 'irq_to_desc'
struct irq_desc *irq_to_desc(unsigned int irq)
^
kernel/irq/irqdesc.c:254:6: error: redefinition of 'early_init_irq_lock_class'
void early_init_irq_lock_class(void)
^
In file included from include/linux/hardirq.h:8:0,
from arch/m68k/include/asm/system_mm.h:69,
from arch/m68k/include/asm/system.h:4,
from include/linux/list.h:8,
from include/linux/smp.h:11,
from include/linux/irq.h:12,
from kernel/irq/irqdesc.c:10:
include/linux/lockdep.h:430:20: note: previous definition of 'early_init_irq_lock_class' was here
static inline void early_init_irq_lock_class(void)
^
kernel/irq/irqdesc.c: In function 'early_init_irq_lock_class':
kernel/irq/irqdesc.c:256:19: warning: unused variable 'desc' [-Wunused-variable]
struct irq_desc *desc;
^
kernel/irq/irqdesc.c: At top level:
kernel/irq/irqdesc.c:264:14: error: redefinition of 'kstat_irqs_cpu'
unsigned int kstat_irqs_cpu(unsigned int irq, int cpu)
^
In file included from kernel/irq/irqdesc.c:14:0:
include/linux/kernel_stat.h:59:28: note: previous definition of 'kstat_irqs_cpu' was here
static inline unsigned int kstat_irqs_cpu(unsigned int irq, int cpu)
^
vim +206 kernel/irq/irqdesc.c
30 #else
31 static void __init init_irq_default_affinity(void)
32 {
33 }
34 #endif
35
> 36 int nr_irqs = NR_IRQS;
37 EXPORT_SYMBOL_GPL(nr_irqs);
38
39 #ifdef CONFIG_SPARSE_IRQ
40
41 static struct irq_desc irq_desc_init = {
42 .status = IRQ_DISABLED,
43 .handle_irq = handle_bad_irq,
44 .depth = 1,
45 .lock = __RAW_SPIN_LOCK_UNLOCKED(irq_desc_init.lock),
46 };
47
48 void __ref init_kstat_irqs(struct irq_desc *desc, int node, int nr)
49 {
50 void *ptr;
51
52 ptr = kzalloc_node(nr * sizeof(*desc->kstat_irqs),
53 GFP_ATOMIC, node);
54
55 /*
56 * don't overwite if can not get new one
57 * init_copy_kstat_irqs() could still use old one
58 */
59 if (ptr) {
60 printk(KERN_DEBUG " alloc kstat_irqs on node %d\n", node);
61 desc->kstat_irqs = ptr;
62 }
63 }
64
65 static void init_one_irq_desc(int irq, struct irq_desc *desc, int node)
66 {
67 memcpy(desc, &irq_desc_init, sizeof(struct irq_desc));
68
69 raw_spin_lock_init(&desc->lock);
70 desc->irq_data.irq = irq;
71 #ifdef CONFIG_SMP
72 desc->irq_data.node = node;
73 #endif
74 lockdep_set_class(&desc->lock, &irq_desc_lock_class);
75 init_kstat_irqs(desc, node, nr_cpu_ids);
76 if (!desc->kstat_irqs) {
77 printk(KERN_ERR "can not alloc kstat_irqs\n");
78 BUG_ON(1);
79 }
80 if (!alloc_desc_masks(desc, node, false)) {
81 printk(KERN_ERR "can not alloc irq_desc cpumasks\n");
82 BUG_ON(1);
83 }
84 init_desc_masks(desc);
85 arch_init_chip_data(desc, node);
86 }
87
88 /*
89 * Protect the sparse_irqs:
90 */
91 DEFINE_RAW_SPINLOCK(sparse_irq_lock);
92
93 static RADIX_TREE(irq_desc_tree, GFP_ATOMIC);
94
95 static void set_irq_desc(unsigned int irq, struct irq_desc *desc)
96 {
97 radix_tree_insert(&irq_desc_tree, irq, desc);
98 }
99
100 struct irq_desc *irq_to_desc(unsigned int irq)
101 {
102 return radix_tree_lookup(&irq_desc_tree, irq);
103 }
104
105 void replace_irq_desc(unsigned int irq, struct irq_desc *desc)
106 {
107 void **ptr;
108
109 ptr = radix_tree_lookup_slot(&irq_desc_tree, irq);
110 if (ptr)
111 radix_tree_replace_slot(ptr, desc);
112 }
113
114 static struct irq_desc irq_desc_legacy[NR_IRQS_LEGACY] __cacheline_aligned_in_smp = {
115 [0 ... NR_IRQS_LEGACY-1] = {
116 .status = IRQ_DISABLED,
117 .handle_irq = handle_bad_irq,
118 .depth = 1,
119 .lock = __RAW_SPIN_LOCK_UNLOCKED(irq_desc_init.lock),
120 }
121 };
122
123 static unsigned int *kstat_irqs_legacy;
124
125 int __init early_irq_init(void)
126 {
127 struct irq_desc *desc;
128 int legacy_count;
129 int node;
130 int i;
131
132 init_irq_default_affinity();
133
134 /* initialize nr_irqs based on nr_cpu_ids */
135 arch_probe_nr_irqs();
136 printk(KERN_INFO "NR_IRQS:%d nr_irqs:%d\n", NR_IRQS, nr_irqs);
137
138 desc = irq_desc_legacy;
139 legacy_count = ARRAY_SIZE(irq_desc_legacy);
140 node = first_online_node;
141
142 /* allocate based on nr_cpu_ids */
143 kstat_irqs_legacy = kzalloc_node(NR_IRQS_LEGACY * nr_cpu_ids *
144 sizeof(int), GFP_NOWAIT, node);
145
146 irq_desc_init.irq_data.chip = &no_irq_chip;
147
148 for (i = 0; i < legacy_count; i++) {
149 desc[i].irq_data.irq = i;
150 desc[i].irq_data.chip = &no_irq_chip;
151 #ifdef CONFIG_SMP
152 desc[i].irq_data.node = node;
153 #endif
154 desc[i].kstat_irqs = kstat_irqs_legacy + i * nr_cpu_ids;
155 lockdep_set_class(&desc[i].lock, &irq_desc_lock_class);
156 alloc_desc_masks(&desc[i], node, true);
157 init_desc_masks(&desc[i]);
158 set_irq_desc(i, &desc[i]);
159 }
160
161 return arch_early_irq_init();
162 }
163
164 struct irq_desc * __ref irq_to_desc_alloc_node(unsigned int irq, int node)
165 {
166 struct irq_desc *desc;
167 unsigned long flags;
168
169 if (irq >= nr_irqs) {
170 WARN(1, "irq (%d) >= nr_irqs (%d) in irq_to_desc_alloc\n",
171 irq, nr_irqs);
172 return NULL;
173 }
174
175 desc = irq_to_desc(irq);
176 if (desc)
177 return desc;
178
179 raw_spin_lock_irqsave(&sparse_irq_lock, flags);
180
181 /* We have to check it to avoid races with another CPU */
182 desc = irq_to_desc(irq);
183 if (desc)
184 goto out_unlock;
185
186 desc = kzalloc_node(sizeof(*desc), GFP_ATOMIC, node);
187
188 printk(KERN_DEBUG " alloc irq_desc for %d on node %d\n", irq, node);
189 if (!desc) {
190 printk(KERN_ERR "can not alloc irq_desc\n");
191 BUG_ON(1);
192 }
193 init_one_irq_desc(irq, desc, node);
194
195 set_irq_desc(irq, desc);
196
197 out_unlock:
198 raw_spin_unlock_irqrestore(&sparse_irq_lock, flags);
199
200 return desc;
201 }
202
203 #else /* !CONFIG_SPARSE_IRQ */
204
205 struct irq_desc irq_desc[NR_IRQS] __cacheline_aligned_in_smp = {
> 206 [0 ... NR_IRQS-1] = {
207 .status = IRQ_DISABLED,
208 .handle_irq = handle_bad_irq,
209 .depth = 1,
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
Download attachment ".config.gz" of type "application/octet-stream" (3460 bytes)
Powered by blists - more mailing lists