Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp4403306pxb; Tue, 10 Nov 2020 15:59:07 -0800 (PST) X-Google-Smtp-Source: ABdhPJxpmJd34zBs+REhu4ffljn1a4Zq2sseuISiGGWwad78yYApZNyGkWStyA6+b3VAmmlJPUWp X-Received: by 2002:a05:6402:1ac5:: with SMTP id ba5mr6493752edb.332.1605052747388; Tue, 10 Nov 2020 15:59:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605052747; cv=none; d=google.com; s=arc-20160816; b=h03jLplIQgOoSGE29WjsyN4v5FHY84yfNIm6+Hj97qnoO9xkuhXPBKzIBqqxWuceZH lXQDTlPWN//d3ZhNDxAmOQ1oRMr7i0T76ynHi0+swoLftpmm/9bv6dXT9RT5rZKwF2PE SoNzoVqNpS94j9NxTcKmwXD/UiX3i6iEPTc0wttAlT+/yw6dQM1hCH9a0CqvNV6lzHxm PdJhDH/HGMIgMs1P2C/EsDn/LKVwRnzXGqDE6s1OPBbur7xOMETu/+WDsaDKyfpL/gjE XKenAXpLMKWJYNC5Y+jcYEyNJ+iZ+aYMMi7kPsLMLY9gVye1Q9fD5fM5vtZucJR5z/zM Yweg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:subject:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:dkim-signature; bh=CemXXlpsOMiyxV9KdJOMOb00+hwTcrKC8bryO5FGpJQ=; b=NTaQxu2G5JtFKjxjmPFWLxENjJdVk9icNtR1KkepRmv1OaiscfTf97U2bouVD791b1 4lrOTUsCJ3XflAbiUO/gWRk5V2Zc/jdkjcB4u//y8XD/P3y3zR3T1H1/yeXaCBxMtk4q w8RUyF6TccV9216p8PsHPKJH/iYvXTxv3fMRIi7QEm7/lWPKWzbcHVp0UAe7e2ittmwP Z2iduxGOZh6xzjPXnLrtqyDSd1U/82cOSCPK3Y+r/BqylnFf/+OS65kMYeEi94AzBmYb ns76Xn/OQ34+FyNUD2R91vhutn+5qY9Wnb1sn6ARP6j7MmK1kFKLY9Aa+TWfNYDFJrhD 0fTw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@deltatee.com header.s=20200525 header.b=qWwyU5J1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s25si133991ejv.48.2020.11.10.15.58.35; Tue, 10 Nov 2020 15:59:07 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail header.i=@deltatee.com header.s=20200525 header.b=qWwyU5J1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732345AbgKJXzp (ORCPT + 99 others); Tue, 10 Nov 2020 18:55:45 -0500 Received: from ale.deltatee.com ([204.191.154.188]:47818 "EHLO ale.deltatee.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726737AbgKJXzo (ORCPT ); Tue, 10 Nov 2020 18:55:44 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=deltatee.com; s=20200525; h=Subject:Content-Transfer-Encoding:Content-Type: In-Reply-To:MIME-Version:Date:Message-ID:From:References:Cc:To:Sender: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=CemXXlpsOMiyxV9KdJOMOb00+hwTcrKC8bryO5FGpJQ=; b=qWwyU5J1VNmv3RUV8GoilaFpTi QuaGEq0gvt+UwTKG1hH9guguo7cit8ihhBZS02oRsG8JOsidQ5iy7SKKvxQau+GpFOG0w1hmrYvPP Bh9mJNGCDs7+q9LU5KQNWHCDOVH+8iAm+32vreXEjdgrZ+I/MeprJN8vXSVbADvdUxWHAAx0fJ9qB n70UNf7p2qt6x0SyIOmBWlidwkiSxNMaYqH52bAWe+rE0PkGtNhukyn3gQxqWHkr1GUJ0mbmLb3ax vIvNOnVZRR2nlQ3JF2EAX9V+LtlVU4Hp4XGIstGIHa8V1e39ZJQUgReLmXTbQoHvgDHmr7M+/iCYV Yd0eJDCg==; Received: from guinness.priv.deltatee.com ([172.16.1.162]) by ale.deltatee.com with esmtp (Exim 4.92) (envelope-from ) id 1kcdUE-0000tZ-31; Tue, 10 Nov 2020 16:55:43 -0700 To: Colin King , Bjorn Helgaas , Stephen Bates , Alex Williamson , =?UTF-8?Q?Christian_K=c3=b6nig?= , linux-pci@vger.kernel.org Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org References: <20201110221048.3411288-1-colin.king@canonical.com> From: Logan Gunthorpe Message-ID: Date: Tue, 10 Nov 2020 16:55:41 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.4.0 MIME-Version: 1.0 In-Reply-To: <20201110221048.3411288-1-colin.king@canonical.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-CA Content-Transfer-Encoding: 7bit X-SA-Exim-Connect-IP: 172.16.1.162 X-SA-Exim-Rcpt-To: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, linux-pci@vger.kernel.org, christian.koenig@amd.com, alex.williamson@redhat.com, sbates@raithlin.com, bhelgaas@google.com, colin.king@canonical.com X-SA-Exim-Mail-From: logang@deltatee.com X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on ale.deltatee.com X-Spam-Level: X-Spam-Status: No, score=-8.9 required=5.0 tests=ALL_TRUSTED,BAYES_00, GREYLIST_ISWHITE,NICE_REPLY_A,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Subject: Re: [PATCH][V2] PCI: Fix a potential uninitentional integer overflow issue 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) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2020-11-10 3:10 p.m., Colin King wrote: > From: Colin Ian King > > The shift of 1 by align_order is evaluated using 32 bit arithmetic > and the result is assigned to a resource_size_t type variable that > is a 64 bit unsigned integer on 64 bit platforms. Fix an overflow > before widening issue by making the 1 a ULL. > > Addresses-Coverity: ("Unintentional integer overflow") > Fixes: 07d8d7e57c28 ("PCI: Make specifying PCI devices in kernel parameters reusable") I think this should probably be Fixes: 32a9a682bef2 ("PCI: allow assignment of memory resources with a specified alignment") That is the commit where the original bug was introduced. 644a544fd9bcd then extends the code a little bit and 07d8d7e57c28 only refactors it into a reusable function. If we want this in older stable kernels then we will probably need to make different patches for the other two vintages. > Signed-off-by: Colin Ian King Besides that, the change makes sense to me. Reviewed-by: Logan Gunthorpe Thanks, Logan