From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 91696C432C0 for ; Fri, 29 Nov 2019 17:58:25 +0000 (UTC) Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 6F3882158A for ; Fri, 29 Nov 2019 17:58:25 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6F3882158A Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=deltatee.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=iommu-bounces@lists.linux-foundation.org Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 4E48786ACB; Fri, 29 Nov 2019 17:58:25 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id bEOC+aispoLT; Fri, 29 Nov 2019 17:58:23 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by whitealder.osuosl.org (Postfix) with ESMTP id 0241A8681B; Fri, 29 Nov 2019 17:58:23 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id E4928C1DD9; Fri, 29 Nov 2019 17:58:22 +0000 (UTC) Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by lists.linuxfoundation.org (Postfix) with ESMTP id E18E0C0881 for ; Fri, 29 Nov 2019 17:58:21 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id CF73323280 for ; Fri, 29 Nov 2019 17:58:21 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id xbu01Fx3DPZk for ; Fri, 29 Nov 2019 17:58:20 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from ale.deltatee.com (ale.deltatee.com [207.54.116.67]) by silver.osuosl.org (Postfix) with ESMTPS id 3CD0923265 for ; Fri, 29 Nov 2019 17:58:20 +0000 (UTC) Received: from s0106ac1f6bb1ecac.cg.shawcable.net ([70.73.163.230] helo=[192.168.11.155]) by ale.deltatee.com with esmtpsa (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1iakX3-0000J2-H1; Fri, 29 Nov 2019 10:58:18 -0700 To: James Sewart , linux-pci@vger.kernel.org References: <20191120193228.GA103670@google.com> <6A902F0D-FE98-4760-ADBB-4D5987D866BE@arista.com> <20191126173833.GA16069@infradead.org> <547214A9-9FD0-4DD5-80E1-1F5A467A0913@arista.com> <9c54c5dd-702c-a19b-38ba-55ab73b24729@deltatee.com> <435064D4-00F0-47F5-94D2-2C354F6B1206@arista.com> <058383d9-69fe-65e3-e410-eebd99840261@deltatee.com> <9DD82D05-6B9E-4AF5-9A3C-D459B75C0089@arista.com> From: Logan Gunthorpe Message-ID: <20f1dbe3-0349-86b6-ca98-f284d34753b7@deltatee.com> Date: Fri, 29 Nov 2019 10:58:15 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <9DD82D05-6B9E-4AF5-9A3C-D459B75C0089@arista.com> Content-Language: en-US X-SA-Exim-Connect-IP: 70.73.163.230 X-SA-Exim-Rcpt-To: helgaas@kernel.org, alex.williamson@redhat.com, dima@arista.com, linux-kernel@vger.kernel.org, iommu@lists.linux-foundation.org, 0x7f454c46@gmail.com, hch@infradead.org, linux-pci@vger.kernel.org, jamessewart@arista.com X-SA-Exim-Mail-From: logang@deltatee.com Subject: Re: [PATCH v5 1/3] PCI: Fix off by one in dma_alias_mask allocation size X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on ale.deltatee.com) Cc: Dmitry Safonov , Dmitry Safonov <0x7f454c46@gmail.com>, iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org, Alex Williamson , Bjorn Helgaas X-BeenThere: iommu@lists.linux-foundation.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Development issues for Linux IOMMU support List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: iommu-bounces@lists.linux-foundation.org Sender: "iommu" On 2019-11-29 10:56 a.m., James Sewart wrote: > The number of possible devfns is 256 so the size of the bitmap for > allocations should be U8_MAX+1. > > Signed-off-by: James Sewart Looks good to me. Thanks! For the whole series: Reviewed-by: Logan Gunthorpe > --- > drivers/pci/pci.c | 2 +- > drivers/pci/search.c | 2 +- > 2 files changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c > index a97e2571a527..0a4449a30ace 100644 > --- a/drivers/pci/pci.c > +++ b/drivers/pci/pci.c > @@ -5876,7 +5876,7 @@ int pci_set_vga_state(struct pci_dev *dev, bool decode, > void pci_add_dma_alias(struct pci_dev *dev, u8 devfn) > { > if (!dev->dma_alias_mask) > - dev->dma_alias_mask = bitmap_zalloc(U8_MAX, GFP_KERNEL); > + dev->dma_alias_mask = bitmap_zalloc(U8_MAX+1, GFP_KERNEL); > if (!dev->dma_alias_mask) { > pci_warn(dev, "Unable to allocate DMA alias mask\n"); > return; > diff --git a/drivers/pci/search.c b/drivers/pci/search.c > index bade14002fd8..b3633af1743b 100644 > --- a/drivers/pci/search.c > +++ b/drivers/pci/search.c > @@ -43,7 +43,7 @@ int pci_for_each_dma_alias(struct pci_dev *pdev, > if (unlikely(pdev->dma_alias_mask)) { > u8 devfn; > > - for_each_set_bit(devfn, pdev->dma_alias_mask, U8_MAX) { > + for_each_set_bit(devfn, pdev->dma_alias_mask, U8_MAX+1) { > ret = fn(pdev, PCI_DEVID(pdev->bus->number, devfn), > data); > if (ret) > _______________________________________________ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu