2019-01-17 08:50:36

by Huacai Chen

[permalink] [raw]
Subject: [PATCH] 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]>
Signed-off-by: Huacai Chen <[email protected]>
---
kernel/irq/irqdesc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/irq/irqdesc.c b/kernel/irq/irqdesc.c
index ee062b7..ef8ad36 100644
--- a/kernel/irq/irqdesc.c
+++ b/kernel/irq/irqdesc.c
@@ -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;
}
--
2.7.0



Subject: [tip:irq/urgent] 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")
Signed-off-by: Huacai Chen <[email protected]>
Signed-off-by: Thomas Gleixner <[email protected]>
Cc: Fuxin Zhang <[email protected]>
Cc: Zhangjin Wu <[email protected]>
Cc: Huacai Chen <[email protected]>
Cc: Dou Liyang <[email protected]>
Link: https://lkml.kernel.org/r/[email protected]

---
kernel/irq/irqdesc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/irq/irqdesc.c b/kernel/irq/irqdesc.c
index ee062b7939d3..ef8ad36cadcf 100644
--- a/kernel/irq/irqdesc.c
+++ b/kernel/irq/irqdesc.c
@@ -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;
}