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=hao.a.wu@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 AF3B0210DF4E2 for ; Mon, 2 Jul 2018 18:04:54 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 02 Jul 2018 18:04:54 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,301,1526367600"; d="scan'208";a="52186517" Received: from fmsmsx104.amr.corp.intel.com ([10.18.124.202]) by fmsmga008.fm.intel.com with ESMTP; 02 Jul 2018 18:04:54 -0700 Received: from fmsmsx101.amr.corp.intel.com (10.18.124.199) by fmsmsx104.amr.corp.intel.com (10.18.124.202) with Microsoft SMTP Server (TLS) id 14.3.319.2; Mon, 2 Jul 2018 18:04:54 -0700 Received: from shsmsx102.ccr.corp.intel.com (10.239.4.154) by fmsmsx101.amr.corp.intel.com (10.18.124.199) with Microsoft SMTP Server (TLS) id 14.3.319.2; Mon, 2 Jul 2018 18:04:53 -0700 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.87]) by shsmsx102.ccr.corp.intel.com ([169.254.2.223]) with mapi id 14.03.0319.002; Tue, 3 Jul 2018 09:04:52 +0800 From: "Wu, Hao A" To: "Zeng, Star" , "edk2-devel@lists.01.org" CC: "Bi, Dandan" , "Zeng, Star" Thread-Topic: [edk2] [PATCH] MdeModulePkg SataControllerDxe: Use compare logic in if condition Thread-Index: AQHUEekDzGlLWMZV3UOzjtBtn2RyCaR8r0zQ Date: Tue, 3 Jul 2018 01:04:51 +0000 Message-ID: References: <1530524539-195620-1-git-send-email-star.zeng@intel.com> In-Reply-To: <1530524539-195620-1-git-send-email-star.zeng@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:04:54 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable 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 St= ar > 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 >=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