summaryrefslogtreecommitdiff
path: root/kernel/irq/ipi.c
diff options
context:
space:
mode:
authorAlexey Dobriyan <adobriyan@gmail.com>2017-08-19 12:57:51 +0300
committerThomas Gleixner <tglx@linutronix.de>2017-08-20 11:49:05 +0300
commit8fbbe2d7cc478d1544f41f2271787c993c23a4f6 (patch)
tree5216664c8a0de1fab6a27d5400042efc132d6901 /kernel/irq/ipi.c
parente8f241893dfbbebe2813c01eac54f263e6a5e59c (diff)
downloadlinux-8fbbe2d7cc478d1544f41f2271787c993c23a4f6.tar.xz
genirq/ipi: Fixup checks against nr_cpu_ids
Valid CPU ids are [0, nr_cpu_ids-1] inclusive. Fixes: 3b8e29a82dd1 ("genirq: Implement ipi_send_mask/single()") Fixes: f9bce791ae2a ("genirq: Add a new function to get IPI reverse mapping") Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Cc: stable@vger.kernel.org Link: http://lkml.kernel.org/r/20170819095751.GB27864@avx2
Diffstat (limited to 'kernel/irq/ipi.c')
-rw-r--r--kernel/irq/ipi.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/kernel/irq/ipi.c b/kernel/irq/ipi.c
index 1a9abc1c8ea0..259a22aa9934 100644
--- a/kernel/irq/ipi.c
+++ b/kernel/irq/ipi.c
@@ -165,7 +165,7 @@ irq_hw_number_t ipi_get_hwirq(unsigned int irq, unsigned int cpu)
struct irq_data *data = irq_get_irq_data(irq);
struct cpumask *ipimask = data ? irq_data_get_affinity_mask(data) : NULL;
- if (!data || !ipimask || cpu > nr_cpu_ids)
+ if (!data || !ipimask || cpu >= nr_cpu_ids)
return INVALID_HWIRQ;
if (!cpumask_test_cpu(cpu, ipimask))
@@ -195,7 +195,7 @@ static int ipi_send_verify(struct irq_chip *chip, struct irq_data *data,
if (!chip->ipi_send_single && !chip->ipi_send_mask)
return -EINVAL;
- if (cpu > nr_cpu_ids)
+ if (cpu >= nr_cpu_ids)
return -EINVAL;
if (dest) {