From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=66.187.233.73; helo=mx1.redhat.com; envelope-from=lersek@redhat.com; receiver=edk2-devel@lists.01.org Received: from mx1.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 0866322352288 for ; Tue, 27 Feb 2018 10:36:03 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B5A1D8163C61; Tue, 27 Feb 2018 18:42:09 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-120-21.rdu2.redhat.com [10.10.120.21]) by smtp.corp.redhat.com (Postfix) with ESMTP id C91F4AFD7C; Tue, 27 Feb 2018 18:42:08 +0000 (UTC) To: =?UTF-8?Q?Marvin_H=c3=a4user?= , "edk2-devel@lists.01.org" Cc: "ruiyu.ni@intel.com" , "eric.dong@intel.com" , "star.zeng@intel.com" References: From: Laszlo Ersek Message-ID: <657bb4e2-7271-6a24-7cd3-aecdaaa005f5@redhat.com> Date: Tue, 27 Feb 2018 19:42:07 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Tue, 27 Feb 2018 18:42:09 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Tue, 27 Feb 2018 18:42:09 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'lersek@redhat.com' RCPT:'' Subject: Re: [PATCH 1/2] MdeModulePkg/PciBusDxe: Prevent truncating constant values. X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Feb 2018 18:36:04 -0000 Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit On 02/27/18 17:49, Marvin Häuser wrote: > The toolcahin VS2015x86 issues warnings when truncating constant > values. Explicitely cast such to avoid it. > > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Marvin Haeuser > --- > MdeModulePkg/Bus/Pci/PciBusDxe/PciResourceSupport.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/MdeModulePkg/Bus/Pci/PciBusDxe/PciResourceSupport.c b/MdeModulePkg/Bus/Pci/PciBusDxe/PciResourceSupport.c > index 2f713fcee95e..a752853f3e9e 100644 > --- a/MdeModulePkg/Bus/Pci/PciBusDxe/PciResourceSupport.c > +++ b/MdeModulePkg/Bus/Pci/PciBusDxe/PciResourceSupport.c > @@ -1936,7 +1936,7 @@ ProgramP2C ( > &BridgeControl > ); > > - BridgeControl &= (UINT16) ~PCI_CARD_PREFETCHABLE_MEMORY_0_ENABLE; > + BridgeControl &= (UINT16) ~(UINT16)PCI_CARD_PREFETCHABLE_MEMORY_0_ENABLE; > PciIo->Pci.Write ( > PciIo, > EfiPciIoWidthUint16, > @@ -2005,7 +2005,7 @@ ProgramP2C ( > &BridgeControl > ); > > - BridgeControl &= (UINT16) ~(PCI_CARD_PREFETCHABLE_MEMORY_1_ENABLE); > + BridgeControl &= (UINT16) ~(UINT16)(PCI_CARD_PREFETCHABLE_MEMORY_1_ENABLE); > PciIo->Pci.Write ( > PciIo, > EfiPciIoWidthUint16, > My recommendation is the same as for: [edk2] [PATCH 2/2] MdeModulePkg/BaseSerialPortLib16550: Prevent truncating constant values. #define PCI_CARD_PREFETCHABLE_MEMORY_0_ENABLE BIT8 #define PCI_CARD_PREFETCHABLE_MEMORY_1_ENABLE BIT9 #define BIT8 0x00000100 #define BIT9 0x00000200 So I suggest (UINT32) for the casts. I'd also suggest a better subject line / commit message. Can we say: Package/Module: avoid bit-negating signed integer constants and then the commit message could quote the VS2015x86 warnings. Again, just my two cents; I defer to the MdeModulePkg maintainers. Thanks! Laszlo