Skip to content

Commit

Permalink
genirq/ipi: Fixup checks against nr_cpu_ids
Browse files Browse the repository at this point in the history
Valid CPU ids are [0, nr_cpu_ids-1] inclusive.

Fixes: 3b8e29a ("genirq: Implement ipi_send_mask/single()")
Fixes: f9bce79 ("genirq: Add a new function to get IPI reverse mapping")
Signed-off-by: Alexey Dobriyan <[email protected]>
Signed-off-by: Thomas Gleixner <[email protected]>
Cc: [email protected]
Link: http://lkml.kernel.org/r/20170819095751.GB27864@avx2
  • Loading branch information
Alexey Dobriyan authored and KAGA-KOKO committed Aug 20, 2017
1 parent e8f2418 commit 8fbbe2d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions kernel/irq/ipi.c
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 8fbbe2d

Please sign in to comment.