From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.151; helo=mga17.intel.com; envelope-from=star.zeng@intel.com; receiver=edk2-devel@lists.01.org Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) (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 25373210E8D6B for ; Mon, 2 Jul 2018 18:17:29 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 02 Jul 2018 18:17:28 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,301,1526367600"; d="scan'208";a="63950249" Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by orsmga003.jf.intel.com with ESMTP; 02 Jul 2018 18:16:52 -0700 Received: from shsmsx151.ccr.corp.intel.com (10.239.6.50) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.319.2; Mon, 2 Jul 2018 18:16:51 -0700 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.223]) by SHSMSX151.ccr.corp.intel.com ([169.254.3.116]) with mapi id 14.03.0319.002; Tue, 3 Jul 2018 09:16:50 +0800 From: "Zeng, Star" To: "Wu, Hao A" , "edk2-devel@lists.01.org" CC: "Bi, Dandan" , "Zeng, Star" Thread-Topic: [edk2] [PATCH] MdeModulePkg SataControllerDxe: Use compare logic in if condition Thread-Index: AQHUEekGgrrgxQiEBUyH9PwoYxThB6R8KcKAgACJU5A= Date: Tue, 3 Jul 2018 01:16:49 +0000 Message-ID: <0C09AFA07DD0434D9E2A0C6AEB0483103BB60B61@shsmsx102.ccr.corp.intel.com> References: <1530524539-195620-1-git-send-email-star.zeng@intel.com> In-Reply-To: Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [PATCH] MdeModulePkg SataControllerDxe: Use compare logic in if condition X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Jul 2018 01:17:29 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Good idea, I agree. Thanks, Star -----Original Message----- From: Wu, Hao A=20 Sent: Tuesday, July 3, 2018 9:05 AM To: Zeng, Star ; edk2-devel@lists.01.org Cc: Bi, Dandan ; Zeng, Star Subject: RE: [edk2] [PATCH] MdeModulePkg SataControllerDxe: Use compare log= ic in if condition Maybe: if ((Data32 & ((UINT32) 1 << MaxPortNumber)) !=3D 0) { instead of: if ((Data32 & (UINT32) (1 << MaxPortNumber)) !=3D 0) { to avoid possible undefined behavior for case like '1 << 31'? Best Regards, Hao Wu > -----Original Message----- > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of=20 > Star Zeng > Sent: Monday, July 02, 2018 5:42 PM > To: edk2-devel@lists.01.org > Cc: Wu, Hao A; Bi, Dandan; Zeng, Star > Subject: [edk2] [PATCH] MdeModulePkg SataControllerDxe: Use compare=20 > logic in if condition >=20 > Use compare logic in if condition to fix ECC issue. > It is caused by aa4240edff41034d709938a15b42cf4fd3214386. >=20 > Cc: Hao Wu > Cc: Dandan Bi > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Star Zeng > --- > MdeModulePkg/Bus/Pci/SataControllerDxe/SataController.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) >=20 > diff --git a/MdeModulePkg/Bus/Pci/SataControllerDxe/SataController.c > b/MdeModulePkg/Bus/Pci/SataControllerDxe/SataController.c > index d47e918f5757..d3af4c626ef5 100644 > --- a/MdeModulePkg/Bus/Pci/SataControllerDxe/SataController.c > +++ b/MdeModulePkg/Bus/Pci/SataControllerDxe/SataController.c > @@ -483,7 +483,7 @@ SataControllerStart ( > } > MaxPortNumber =3D 31; > while (MaxPortNumber > 0) { > - if (Data32 & (1 << MaxPortNumber)) { > + if ((Data32 & (UINT32) (1 << MaxPortNumber)) !=3D 0) { > break; > } > MaxPortNumber--; > -- > 2.7.0.windows.1 >=20 > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel