Messages in this thread | | | Date | Mon, 21 Feb 2011 14:37:29 +0100 (CET) | From | Thomas Gleixner <> | Subject | Re: [tip:irq/core] genirq: Make nr_irqs runtime expandable |
| |
On Sat, 19 Feb 2011, Yinghai Lu wrote: > On 02/19/2011 04:15 AM, tip-bot for Thomas Gleixner wrote: > [PATCH] genirq: use IRQ_BITMAP_BITS as search size > > instead of nr_irqs. > > Otherwise bitmap_find_next_area could exit with larger start and in extreme > case we could fail to get wrong irqs return. > > For example: > IRQ_BITMAP_BITS=10240 > nr_irqs=8192 > cnt=2048 > > and bit 0 to bit 8190 are set already. > > before patch start from bit_find_next_area() will be 8191+2048. > later irq_expand_nr_irqs will set nr_irqs 10240. > finally irq_alloc_descs will return [8191+2048, 8191+2048+2047] happily.. > > with this patch, will get correct [8191, 8191+2047]
What a horrible changelog.
> Signed-off-by: Yinghai Lu <yinghai@kernel.org> > > --- > kernel/irq/irqdesc.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > Index: linux-2.6/kernel/irq/irqdesc.c > =================================================================== > --- linux-2.6.orig/kernel/irq/irqdesc.c > +++ linux-2.6/kernel/irq/irqdesc.c > @@ -346,12 +346,13 @@ irq_alloc_descs(int irq, unsigned int fr > > mutex_lock(&sparse_irq_lock); > > - start = bitmap_find_next_zero_area(allocated_irqs, nr_irqs, from, cnt, 0); > + start = bitmap_find_next_zero_area(allocated_irqs, IRQ_BITMAP_BITS, > + from, cnt, 0); > ret = -EEXIST; > if (irq >=0 && start != irq) > goto err; > > - if (start >= nr_irqs) { > + if (start + cnt > nr_irqs) {
One off. That needs to be >= nr_irqs. Good catch otherwise.
Thanks,
tglx
| |