From: Joe Perches <joe@perches.com>
To: Ralf Baechle <ralf@linux-mips.org>
Cc: linux-mips <linux-mips@linux-mips.org>,
LKML <linux-kernel@vger.kernel.org>,
Gabor Juhos <juhosg@openwrt.org>,
Manuel Lauss <manuel.lauss@googlemail.com>,
John Crispin <blogic@openwrt.org>
Subject: Re: [PATCH] mips: irq: Use DECLARE_BITMAP
Date: Thu, 21 May 2015 09:10:31 -0700 [thread overview]
Message-ID: <1432224631.20840.45.camel@perches.com> (raw)
In-Reply-To: <20150521131429.GA8177@linux-mips.org>
On Thu, 2015-05-21 at 15:14 +0200, Ralf Baechle wrote:
> On Wed, May 20, 2015 at 05:44:54AM -0700, Joe Perches wrote:
>
> > Use the generic mechanism to declare a bitmap instead of unsigned long.
> >
> > This could fix an overwrite defect of whatever follows irq_map.
> >
> > Not all "#define NR_IRQS <value>" are a multiple of BITS_PER_LONG so
> > using DECLARE_BITMAP allocates the proper number of longs required
> > for the possible bits.
> >
> > For instance:
> >
> > arch/mips/include/asm/mach-ath79/irq.h:#define NR_IRQS 51
> > arch/mips/include/asm/mach-db1x00/irq.h:#define NR_IRQS 152
> > arch/mips/include/asm/mach-lantiq/falcon/irq.h:#define NR_IRQS 328
>
> This only matters to user of the allocate_irqno() API and there is only
> on such platform, the IP27 which fortunately uses a NR_IRQS value that
> is a multiple of 64, so no impact.
>
> Thanks anyway!
I think you should apply it anyway as it's an
error-prone style.
There are 3 mechanisms used today in the kernel
to declare bitmap arrays.
DECLARE_BITMAP(array, size)
unsigned long array[BITS_TO_LONGS(size)]
unsigned long array[size/BITS_PER_LONG]
The first 2 are fine, the last has this defect
possible whenever size % BITS_PER_LONG != 0.
The series I sent converts all the uses of the
the possibly defective style.
cheers, Joe
prev parent reply other threads:[~2015-05-21 16:10 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-20 12:44 [PATCH] mips: irq: Use DECLARE_BITMAP Joe Perches
2015-05-21 13:14 ` Ralf Baechle
2015-05-21 16:10 ` Joe Perches [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1432224631.20840.45.camel@perches.com \
--to=joe@perches.com \
--cc=blogic@openwrt.org \
--cc=juhosg@openwrt.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@linux-mips.org \
--cc=manuel.lauss@googlemail.com \
--cc=ralf@linux-mips.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.