From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1422761AbbEUQKi (ORCPT ); Thu, 21 May 2015 12:10:38 -0400 Received: from smtprelay0048.hostedemail.com ([216.40.44.48]:53951 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1422690AbbEUQKf (ORCPT ); Thu, 21 May 2015 12:10:35 -0400 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::::::::::,RULES_HIT:41:355:379:541:599:960:988:989:1260:1277:1311:1313:1314:1345:1359:1373:1437:1515:1516:1518:1534:1541:1593:1594:1711:1730:1747:1777:1792:1981:2110:2194:2198:2199:2200:2393:2553:2559:2562:2828:3138:3139:3140:3141:3142:3353:3622:3865:3866:3867:3868:3870:3871:3872:3873:3874:4321:4605:5007:6261:8603:9040:9121:10004:10400:10848:11026:11232:11473:11658:11914:12043:12050:12296:12517:12519:12740:13069:13141:13161:13229:13230:13311:13357:21080,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:none,Custom_rules:0:0:0 X-HE-Tag: pen34_5c043a3d91350 X-Filterd-Recvd-Size: 2307 Message-ID: <1432224631.20840.45.camel@perches.com> Subject: Re: [PATCH] mips: irq: Use DECLARE_BITMAP From: Joe Perches To: Ralf Baechle Cc: linux-mips , LKML , Gabor Juhos , Manuel Lauss , John Crispin Date: Thu, 21 May 2015 09:10:31 -0700 In-Reply-To: <20150521131429.GA8177@linux-mips.org> References: <1432125894.2870.284.camel@perches.com> <20150521131429.GA8177@linux-mips.org> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.12.11-0ubuntu3 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.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 " 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