From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752262AbdLLOdh convert rfc822-to-8bit (ORCPT ); Tue, 12 Dec 2017 09:33:37 -0500 Received: from smtp-out6.electric.net ([192.162.217.182]:64561 "EHLO smtp-out6.electric.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751234AbdLLOde (ORCPT ); Tue, 12 Dec 2017 09:33:34 -0500 From: David Laight To: "'Niklas Cassel'" , "linux-pci@vger.kernel.org" CC: "kishon@ti.com" , Niklas Cassel , "linux-kernel@vger.kernel.org" Subject: RE: [PATCH v4 0/3] Fix find_first_zero_bit() usage Thread-Topic: [PATCH v4 0/3] Fix find_first_zero_bit() usage Thread-Index: AQHTc1Prbl67XzGOdkOu7z5JxXfihKM/xGXA Date: Tue, 12 Dec 2017 14:33:52 +0000 Message-ID: <5a6a30994101482c94f16203e3c8ba7d@AcuMS.aculab.com> References: <20171212141634.5985-1-niklas.cassel@axis.com> In-Reply-To: <20171212141634.5985-1-niklas.cassel@axis.com> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.202.205.33] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 X-Outbound-IP: 156.67.243.126 X-Env-From: David.Laight@ACULAB.COM X-Proto: esmtps X-Revdns: X-HELO: AcuMS.aculab.com X-TLS: TLSv1.2:ECDHE-RSA-AES256-SHA384:256 X-Authenticated_ID: X-PolicySMART: 3396946, 3397078 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Niklas Cassel > find_first_zero_bit()'s parameter 'size' is defined in bits, > not in bytes. > > Calling find_first_zero_bit() with the wrong size unit > will lead to insidious bugs. > > Fix all uses of find_first_zero_bit() called with > sizeof() as size argument in drivers/pci. ... Isn't all this code just using the wrong function. Shouldn't they be using ffz() (or whatever it is called) to find the first zero in a numeric argument rather that find_first_zero_bit() which is intended for large bitmaps. Perhaps the type for 'large bitmaps' should be: struct { unsigned long bitmap_bits[0]; } bitmap; rather than unsigned long[]. David