Received: by 10.223.176.5 with SMTP id f5csp2700904wra; Mon, 5 Feb 2018 08:26:28 -0800 (PST) X-Google-Smtp-Source: AH8x225E5dzPz1CXv2ibovehV6m69QhBhIOAVI041mcm10Wx9EAU20Osm9jHKZZKE0wVvr6trgSh X-Received: by 2002:a17:902:a4:: with SMTP id a33-v6mr44654389pla.257.1517847988614; Mon, 05 Feb 2018 08:26:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517847988; cv=none; d=google.com; s=arc-20160816; b=iXZVuzMg8knmPfUfrtS8rlJltk25QqICBxV/K035z0H47eliFcIo4+F5NJNFQ0r2r2 NyzTxY8WFX1jwjn1K0vtS1ZPGavxripqk/KAyKBUwxAMCU3vS3S5n+NIw3S5gFOiaaZk wTdE+lOla8dmOnlcBsgyup3x5SiMMZS8l4whu76PAXTwC9YtTKhcZU0jSRFttR+/4EnX g1Q//cEdLx+CBoivlHDfySGLAnyovANpzgALsDSNmkcyhndEjc3mruAcYFjR+oE55ek/ XdTIXKn8TAQWsaSKnDAB1vIKcMR1ZzAqyUe3YMnm/+KlOHqFIlB30u4Eo9XTxip0bhe2 E/Zg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=UlUK4YpgJavg6iY14o4w0hw41HWihES3OlqOWMb3J9I=; b=Yr/DuqWrOw3peplrHIdX+8mktZbZOcjiqgjPsYU5bxlcDDmB8bk7U14amr3n9ptu3I mHZNplG9CSd85my5MnoA9uud7rKps+DFS1NKiHTHaWE8gIR49hxeUWBtCNjcmPZcMaAW 4ReptiirEasgL21hR9S2zawdAiNZvNJybNBIRYGNatHrkoLe/UzqMGmpa3oEwiAoID4K aGthoC4gQTaOFMZdS2YR+CZ+zRt4nPtMfOXnXiXhqtGncep94WxsjVIVMp5wN/aRa9M0 SoMd88ad1FRAguVGjmt+6DhnLwX+gKYPCRrcwj2q/GowOHH4kgdJjmXuE6YvoRBHsivy kPAQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k5-v6si7354323pln.144.2018.02.05.08.26.13; Mon, 05 Feb 2018 08:26:28 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753277AbeBEQZ3 (ORCPT + 99 others); Mon, 5 Feb 2018 11:25:29 -0500 Received: from bastet.se.axis.com ([195.60.68.11]:58221 "EHLO bastet.se.axis.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752972AbeBEQZW (ORCPT ); Mon, 5 Feb 2018 11:25:22 -0500 Received: from localhost (localhost [127.0.0.1]) by bastet.se.axis.com (Postfix) with ESMTP id 87EAF18514; Mon, 5 Feb 2018 17:25:21 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at bastet.se.axis.com Received: from bastet.se.axis.com ([IPv6:::ffff:127.0.0.1]) by localhost (bastet.se.axis.com [::ffff:127.0.0.1]) (amavisd-new, port 10024) with LMTP id WqGn_-G1Kb-b; Mon, 5 Feb 2018 17:25:20 +0100 (CET) Received: from boulder03.se.axis.com (boulder03.se.axis.com [10.0.8.17]) by bastet.se.axis.com (Postfix) with ESMTPS id 6CD571864B; Mon, 5 Feb 2018 17:25:20 +0100 (CET) Received: from boulder03.se.axis.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4E1151E092; Mon, 5 Feb 2018 17:25:20 +0100 (CET) Received: from boulder03.se.axis.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 41DED1E091; Mon, 5 Feb 2018 17:25:20 +0100 (CET) Received: from seth.se.axis.com (unknown [10.0.2.172]) by boulder03.se.axis.com (Postfix) with ESMTP; Mon, 5 Feb 2018 17:25:20 +0100 (CET) Received: from lnxartpec1.se.axis.com (lnxartpec1.se.axis.com [10.88.4.10]) by seth.se.axis.com (Postfix) with ESMTP id 3484C2A2B; Mon, 5 Feb 2018 17:25:20 +0100 (CET) Received: by lnxartpec1.se.axis.com (Postfix, from userid 20283) id 2CD8A401B8; Mon, 5 Feb 2018 17:25:20 +0100 (CET) Date: Mon, 5 Feb 2018 17:25:20 +0100 From: Niklas Cassel To: Jingoo Han Cc: 'Andy Shevchenko' , 'Kishon Vijay Abraham I' , 'Joao Pinto' , 'Lorenzo Pieralisi' , 'Bjorn Helgaas' , linux-pci@vger.kernel.org, 'Linux Kernel Mailing List' Subject: Re: [PATCH 3/3] PCI: designware-ep: Return an error when requesting a too large BAR size Message-ID: <20180205162519.GA3044@axis.com> References: <20180201161119.3852-1-niklas.cassel@axis.com> <20180201161119.3852-4-niklas.cassel@axis.com> <000601d39b8e$f58a76f0$e09f64d0$@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <000601d39b8e$f58a76f0$e09f64d0$@gmail.com> User-Agent: Mutt/1.9.1+16 (8a41d1c2f267) (2017-09-22) X-TM-AS-GCONF: 00 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Feb 01, 2018 at 02:00:40PM -0500, Jingoo Han wrote: > On Thursday, February 1, 2018 1:58 PM, Andy Shevchenko wrote: > > > > On Thu, Feb 1, 2018 at 6:11 PM, Niklas Cassel > > wrote: > > > > include/linux/sizes.h: > > > > +SZ_4G 0x100000000ULL > > > > > + if (size > 0x100000000ULL) { > > > > #include > > > > if (size > SZ_4G) { > > I like this one for the readability. > Thank you. > I liked it too, however both variants if (size > 0x100000000ULL) { if (size > SZ_4G) { result in: drivers/pci/dwc/pcie-designware-ep.c:131:11: warning: comparison is always false due to limited range of data type [-Wtype-limits] when compiling with W=1 on a platform with 32-bit size_t. The annoying thing here is that a BAR can be 64-bit, yet the parameter size is defined as a size_t, so the error will only show on 32-bit and not on 64-bit. What do you think about: if (upper_32_bits(size)) { dev_err(pci->dev, "can't handle BAR larger than 4GB\n"); return -EINVAL; } That should compile without warnings for both 32-bit size_t and 64-bit size_t. Regards, Niklas