Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1338015

Re: [PATCH v2] irqchip: irq-mvebu-odmi: new driver for platform MSI on Marvell 7K/8K

From Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Newsgroups linux.kernel
Subject Re: [PATCH v2] irqchip: irq-mvebu-odmi: new driver for platform MSI on Marvell 7K/8K
Date 2016-02-19 10:40 +0100
Message-ID <r3PHA-2Xv-9@gated-at.bofh.it> (permalink)
References <r3z9N-7KJ-37@gated-at.bofh.it> <r3zW9-8pq-3@gated-at.bofh.it>
Organization Free Electrons

Show all headers | View raw


Marc,

On Thu, 18 Feb 2016 16:41:23 +0000, Marc Zyngier wrote:

> It looks really nice, except for a couple of points, see below.

Thanks again for the review.

> > +/*
> > + * We don't support the group events, so we simply have 8 interrupts
> > + * per frame.
> > + */
> > +#define NODMIS_PER_FRAME 8
> > +#define NODMIS_SHIFT     3
> > +#define NODMIS_MASK      7
> 
> All these values are directly related, so it would be nice if they would
> be expressed in term of each other:
> 
> #define NODMIS_SHIFT	 3
> #define NODMIS_PER_FRAME (1 << NODMIS_SHIFT)
> #define NODMIS_MASK      (NODMIS_PER_FRAME - 1)

Good point, will do.

> > +	odmis_bm = kzalloc(odmis_count * NODMIS_PER_FRAME / BITS_PER_BYTE,
> > +			   GFP_KERNEL);
> 
> Blah. this will allocate the exact number of bytes, which you will then
> access as longs, touching memory that's not yours in the process (I've
> been recently bitten and publicly shamed...).

Aah, yes.

> Consider the following:
> 
> odmis_bm = kzalloc(BITS_TO_LONGS(odmis_count * NODMIS_PER_FRAME) *
> sizeof(long), GFP_KERNEL);

Will do.

Thanks!

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PATCH v2] irqchip: irq-mvebu-odmi: new driver for platform MSI on Marvell 7K/8K Thomas Petazzoni <thomas.petazzoni@free-electrons.com> - 2016-02-18 17:00 +0100
  Re: [PATCH v2] irqchip: irq-mvebu-odmi: new driver for platform MSI on Marvell 7K/8K Arnd Bergmann <arnd@arndb.de> - 2016-02-18 17:10 +0100
    Re: [PATCH v2] irqchip: irq-mvebu-odmi: new driver for platform MSI  on Marvell 7K/8K Thomas Petazzoni <thomas.petazzoni@free-electrons.com> - 2016-02-18 17:20 +0100
      Re: [PATCH v2] irqchip: irq-mvebu-odmi: new driver for platform MSI on Marvell 7K/8K Arnd Bergmann <arnd@arndb.de> - 2016-02-18 17:30 +0100
  Re: [PATCH v2] irqchip: irq-mvebu-odmi: new driver for platform MSI  on Marvell 7K/8K Marc Zyngier <marc.zyngier@arm.com> - 2016-02-18 17:50 +0100
    Re: [PATCH v2] irqchip: irq-mvebu-odmi: new driver for platform MSI  on Marvell 7K/8K Thomas Petazzoni <thomas.petazzoni@free-electrons.com> - 2016-02-19 10:40 +0100

csiph-web