From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.24; helo=mga09.intel.com; envelope-from=hao.a.wu@intel.com; receiver=edk2-devel@lists.01.org Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) (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 AC4D4210DC1CA for ; Mon, 2 Jul 2018 18:21:58 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 02 Jul 2018 18:21:58 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,301,1526367600"; d="scan'208";a="69151688" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by fmsmga001.fm.intel.com with ESMTP; 02 Jul 2018 18:21:57 -0700 Received: from FMSMSX109.amr.corp.intel.com (10.18.116.9) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.319.2; Mon, 2 Jul 2018 18:21:57 -0700 Received: from shsmsx103.ccr.corp.intel.com (10.239.4.69) by fmsmsx109.amr.corp.intel.com (10.18.116.9) with Microsoft SMTP Server (TLS) id 14.3.319.2; Mon, 2 Jul 2018 18:21:56 -0700 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.87]) by SHSMSX103.ccr.corp.intel.com ([169.254.4.51]) with mapi id 14.03.0319.002; Tue, 3 Jul 2018 09:21:55 +0800 From: "Wu, Hao A" To: "Zeng, Star" , "edk2-devel@lists.01.org" CC: "Bi, Dandan" Thread-Topic: [edk2] [PATCH] MdeModulePkg SataControllerDxe: Use compare logic in if condition Thread-Index: AQHUEekDzGlLWMZV3UOzjtBtn2RyCaR8r0zQ//99zoCAAIdrQA== Date: Tue, 3 Jul 2018 01:21:55 +0000 Message-ID: References: <1530524539-195620-1-git-send-email-star.zeng@intel.com> <0C09AFA07DD0434D9E2A0C6AEB0483103BB60B61@shsmsx102.ccr.corp.intel.com> In-Reply-To: <0C09AFA07DD0434D9E2A0C6AEB0483103BB60B61@shsmsx102.ccr.corp.intel.com> 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:21:58 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Thanks. And with the change: Reviewed-by: Hao Wu Best Regards, Hao Wu > -----Original Message----- > From: Zeng, Star > Sent: Tuesday, July 03, 2018 9:17 AM > To: Wu, Hao A; edk2-devel@lists.01.org > Cc: Bi, Dandan; Zeng, Star > Subject: RE: [edk2] [PATCH] MdeModulePkg SataControllerDxe: Use compare > logic in if condition >=20 > Good idea, I agree. >=20 > Thanks, > Star > -----Original Message----- > From: Wu, Hao A > 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 > logic in if condition >=20 > Maybe: > if ((Data32 & ((UINT32) 1 << MaxPortNumber)) !=3D 0) { instead of: > if ((Data32 & (UINT32) (1 << MaxPortNumber)) !=3D 0) { >=20 > to avoid possible undefined behavior for case like '1 << 31'? >=20 > Best Regards, > Hao Wu >=20 >=20 > > -----Original Message----- > > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of > > 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 > > logic in if condition > > > > Use compare logic in if condition to fix ECC issue. > > It is caused by aa4240edff41034d709938a15b42cf4fd3214386. > > > > 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(-) > > > > 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 > > > > _______________________________________________ > > edk2-devel mailing list > > edk2-devel@lists.01.org > > https://lists.01.org/mailman/listinfo/edk2-devel