public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] genirq/irqdesc: Fix a bug in alloc_descs()
@ 2019-01-17  3:00 Huacai Chen
  2019-01-17 23:45 ` [tip:irq/urgent] genirq/irqdesc: Fix double increment " tip-bot for Huacai Chen
  0 siblings, 1 reply; 2+ messages in thread
From: Huacai Chen @ 2019-01-17  3:00 UTC (permalink / raw)
  To: Thomas Gleixner
  Cc: linux-kernel, Fuxin Zhang, Zhangjin Wu, Huacai Chen, Huacai Chen,
	Dou Liyang

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 <douliyangs@gmail.com>
Signed-off-by: Huacai Chen <chenhc@lemote.com>
---
 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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [tip:irq/urgent] genirq/irqdesc: Fix double increment in alloc_descs()
  2019-01-17  3:00 [PATCH] genirq/irqdesc: Fix a bug in alloc_descs() Huacai Chen
@ 2019-01-17 23:45 ` tip-bot for Huacai Chen
  0 siblings, 0 replies; 2+ messages in thread
From: tip-bot for Huacai Chen @ 2019-01-17 23:45 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: hpa, chenhc, zhangfx, douliyangs, tglx, wuzhangjin, chenhuacai,
	linux-kernel, mingo

Commit-ID:  12fee4cd5be2c4a73cc13d7ad76eb2d2feda8a71
Gitweb:     https://git.kernel.org/tip/12fee4cd5be2c4a73cc13d7ad76eb2d2feda8a71
Author:     Huacai Chen <chenhc@lemote.com>
AuthorDate: Thu, 17 Jan 2019 11:00:09 +0800
Committer:  Thomas Gleixner <tglx@linutronix.de>
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 <chenhc@lemote.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Fuxin Zhang <zhangfx@lemote.com>
Cc: Zhangjin Wu <wuzhangjin@gmail.com>
Cc: Huacai Chen <chenhuacai@gmail.com>
Cc: Dou Liyang <douliyangs@gmail.com>
Link: https://lkml.kernel.org/r/1547694009-16261-1-git-send-email-chenhc@lemote.com

---
 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;
 		}

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-01-17 23:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-01-17  3:00 [PATCH] genirq/irqdesc: Fix a bug in alloc_descs() Huacai Chen
2019-01-17 23:45 ` [tip:irq/urgent] genirq/irqdesc: Fix double increment " tip-bot for Huacai Chen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox