From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1423020AbcBSJfn (ORCPT ); Fri, 19 Feb 2016 04:35:43 -0500 Received: from down.free-electrons.com ([37.187.137.238]:44115 "EHLO mail.free-electrons.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1422838AbcBSJfl (ORCPT ); Fri, 19 Feb 2016 04:35:41 -0500 Date: Fri, 19 Feb 2016 10:35:35 +0100 From: Thomas Petazzoni To: Marc Zyngier Cc: Thomas Gleixner , Jason Cooper , linux-kernel@vger.kernel.org, Andrew Lunn , Sebastian Hesselbarth , Gregory Clement , Nadav Haklai , Lior Amsalem , linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH v2] irqchip: irq-mvebu-odmi: new driver for platform MSI on Marvell 7K/8K Message-ID: <20160219103535.28062901@free-electrons.com> In-Reply-To: <56C5F433.8010701@arm.com> References: <1455811134-3679-1-git-send-email-thomas.petazzoni@free-electrons.com> <56C5F433.8010701@arm.com> Organization: Free Electrons X-Mailer: Claws Mail 3.12.0 (GTK+ 2.24.28; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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