Skip to contentSkip to conversation

genirq/irqdesc: Fix a bug in alloc_descs()

PATCH New Huacai Chen 2 participants 2 messages Jan 17, 2019 IRQ

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 genirq/irqdesc: Fix a bug in alloc_descs()

Commit c410abbbacb9b378365b ("genirq/affinity: Add is_managed to struct irq_affinity_desc") introduce a bug in the for-loop in alloc_descs() by accident. So fix it.

Fixes c410abbbacb9b378365b ("genirq/affinity: Add is_managed to struct irq_affinity_desc")
Cc Dou Liyang <[email protected]>
---
 kernel/irq/irqdesc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/irq/irqdesc.c +1 -1
index ee062b7..ef8ad36 100644
@@ -457,7 +457,7 @@ static int alloc_descs(unsigned int start, unsigned int cnt, int node,
 
 	/* Validate affinity mask(s) */
 	if (affinity) {
-		for (i = 0; i < cnt; i++, i++) {
+		for (i = 0; i < cnt; i++) {
 			if (cpumask_empty(&affinity[i].mask))
 				return -EINVAL;
 		}
Signature · 1 line
2.7.0
#1 lore raw

[tip:irq/urgent] genirq/irqdesc: Fix double increment in alloc_descs()

genirq/irqdesc: Fix double increment in alloc_descs()
Commit-ID:  12fee4cd5be2c4a73cc13d7ad76eb2d2feda8a71
Gitweb:     https://git.kernel.org/tip/12fee4cd5be2c4a73cc13d7ad76eb2d2feda8a71
Author:     Huacai Chen <[email protected]>
AuthorDate: Thu, 17 Jan 2019 11:00:09 +0800
Committer:  Thomas Gleixner <[email protected]>
CommitDate: Fri, 18 Jan 2019 00:43:09 +0100

genirq/irqdesc: Fix double increment in alloc_descs()

The recent rework of alloc_descs() introduced a double increment of the loop counter. As a consequence only every second affinity mask is validated.

Remove it.

[ tglx: Massaged changelog ]

Fixes c410abbbacb9 ("genirq/affinity: Add is_managed to struct irq_affinity_desc")
Cc Fuxin Zhang <[email protected]>
Cc Zhangjin Wu <[email protected]>
Cc Huacai Chen <[email protected]>
Cc Dou Liyang <[email protected]>
---
 kernel/irq/irqdesc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/irq/irqdesc.c +1 -1
index ee062b7939d3..ef8ad36cadcf 100644
@@ -457,7 +457,7 @@ static int alloc_descs(unsigned int start, unsigned int cnt, int node,
 
 	/* Validate affinity mask(s) */
 	if (affinity) {
-		for (i = 0; i < cnt; i++, i++) {
+		for (i = 0; i < cnt; i++) {
 			if (cpumask_empty(&affinity[i].mask))
 				return -EINVAL;
 		}