* [PATCH] MdeModulePkg SataControllerDxe: Use compare logic in if condition @ 2018-07-02 9:42 Star Zeng 2018-07-03 0:51 ` Bi, Dandan 2018-07-03 1:04 ` Wu, Hao A 0 siblings, 2 replies; 5+ messages in thread From: Star Zeng @ 2018-07-02 9:42 UTC (permalink / raw) To: edk2-devel; +Cc: Star Zeng, Hao Wu, Dandan Bi Use compare logic in if condition to fix ECC issue. It is caused by aa4240edff41034d709938a15b42cf4fd3214386. Cc: Hao Wu <hao.a.wu@intel.com> Cc: Dandan Bi <dandan.bi@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Star Zeng <star.zeng@intel.com> --- 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 = 31; while (MaxPortNumber > 0) { - if (Data32 & (1 << MaxPortNumber)) { + if ((Data32 & (UINT32) (1 << MaxPortNumber)) != 0) { break; } MaxPortNumber--; -- 2.7.0.windows.1 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] MdeModulePkg SataControllerDxe: Use compare logic in if condition 2018-07-02 9:42 [PATCH] MdeModulePkg SataControllerDxe: Use compare logic in if condition Star Zeng @ 2018-07-03 0:51 ` Bi, Dandan 2018-07-03 1:04 ` Wu, Hao A 1 sibling, 0 replies; 5+ messages in thread From: Bi, Dandan @ 2018-07-03 0:51 UTC (permalink / raw) To: Zeng, Star, edk2-devel@lists.01.org; +Cc: Wu, Hao A, Zeng, Star Reviewed-by: Dandan Bi <dandan.bi@intel.com> Thanks, Dandan -----Original Message----- From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Star Zeng Sent: Monday, July 2, 2018 5:42 PM To: edk2-devel@lists.01.org Cc: Wu, Hao A <hao.a.wu@intel.com>; Bi, Dandan <dandan.bi@intel.com>; Zeng, Star <star.zeng@intel.com> 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 <hao.a.wu@intel.com> Cc: Dandan Bi <dandan.bi@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Star Zeng <star.zeng@intel.com> --- 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 = 31; while (MaxPortNumber > 0) { - if (Data32 & (1 << MaxPortNumber)) { + if ((Data32 & (UINT32) (1 << MaxPortNumber)) != 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 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] MdeModulePkg SataControllerDxe: Use compare logic in if condition 2018-07-02 9:42 [PATCH] MdeModulePkg SataControllerDxe: Use compare logic in if condition Star Zeng 2018-07-03 0:51 ` Bi, Dandan @ 2018-07-03 1:04 ` Wu, Hao A 2018-07-03 1:16 ` Zeng, Star 1 sibling, 1 reply; 5+ messages in thread From: Wu, Hao A @ 2018-07-03 1:04 UTC (permalink / raw) To: Zeng, Star, edk2-devel@lists.01.org; +Cc: Bi, Dandan, Zeng, Star Maybe: if ((Data32 & ((UINT32) 1 << MaxPortNumber)) != 0) { instead of: if ((Data32 & (UINT32) (1 << MaxPortNumber)) != 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 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 <hao.a.wu@intel.com> > Cc: Dandan Bi <dandan.bi@intel.com> > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Star Zeng <star.zeng@intel.com> > --- > 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 = 31; > while (MaxPortNumber > 0) { > - if (Data32 & (1 << MaxPortNumber)) { > + if ((Data32 & (UINT32) (1 << MaxPortNumber)) != 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 ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] MdeModulePkg SataControllerDxe: Use compare logic in if condition 2018-07-03 1:04 ` Wu, Hao A @ 2018-07-03 1:16 ` Zeng, Star 2018-07-03 1:21 ` Wu, Hao A 0 siblings, 1 reply; 5+ messages in thread From: Zeng, Star @ 2018-07-03 1:16 UTC (permalink / raw) To: Wu, Hao A, edk2-devel@lists.01.org; +Cc: Bi, Dandan, Zeng, Star Good idea, I agree. Thanks, Star -----Original Message----- From: Wu, Hao A Sent: Tuesday, July 3, 2018 9:05 AM To: Zeng, Star <star.zeng@intel.com>; edk2-devel@lists.01.org Cc: Bi, Dandan <dandan.bi@intel.com>; Zeng, Star <star.zeng@intel.com> Subject: RE: [edk2] [PATCH] MdeModulePkg SataControllerDxe: Use compare logic in if condition Maybe: if ((Data32 & ((UINT32) 1 << MaxPortNumber)) != 0) { instead of: if ((Data32 & (UINT32) (1 << MaxPortNumber)) != 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 > 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 <hao.a.wu@intel.com> > Cc: Dandan Bi <dandan.bi@intel.com> > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Star Zeng <star.zeng@intel.com> > --- > 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 = 31; > while (MaxPortNumber > 0) { > - if (Data32 & (1 << MaxPortNumber)) { > + if ((Data32 & (UINT32) (1 << MaxPortNumber)) != 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 ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] MdeModulePkg SataControllerDxe: Use compare logic in if condition 2018-07-03 1:16 ` Zeng, Star @ 2018-07-03 1:21 ` Wu, Hao A 0 siblings, 0 replies; 5+ messages in thread From: Wu, Hao A @ 2018-07-03 1:21 UTC (permalink / raw) To: Zeng, Star, edk2-devel@lists.01.org; +Cc: Bi, Dandan Thanks. And with the change: Reviewed-by: Hao Wu <hao.a.wu@intel.com> 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 > > Good idea, I agree. > > Thanks, > Star > -----Original Message----- > From: Wu, Hao A > Sent: Tuesday, July 3, 2018 9:05 AM > To: Zeng, Star <star.zeng@intel.com>; edk2-devel@lists.01.org > Cc: Bi, Dandan <dandan.bi@intel.com>; Zeng, Star <star.zeng@intel.com> > Subject: RE: [edk2] [PATCH] MdeModulePkg SataControllerDxe: Use compare > logic in if condition > > Maybe: > if ((Data32 & ((UINT32) 1 << MaxPortNumber)) != 0) { instead of: > if ((Data32 & (UINT32) (1 << MaxPortNumber)) != 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 > > 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 <hao.a.wu@intel.com> > > Cc: Dandan Bi <dandan.bi@intel.com> > > Contributed-under: TianoCore Contribution Agreement 1.1 > > Signed-off-by: Star Zeng <star.zeng@intel.com> > > --- > > 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 = 31; > > while (MaxPortNumber > 0) { > > - if (Data32 & (1 << MaxPortNumber)) { > > + if ((Data32 & (UINT32) (1 << MaxPortNumber)) != 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 ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2018-07-03 1:21 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2018-07-02 9:42 [PATCH] MdeModulePkg SataControllerDxe: Use compare logic in if condition Star Zeng 2018-07-03 0:51 ` Bi, Dandan 2018-07-03 1:04 ` Wu, Hao A 2018-07-03 1:16 ` Zeng, Star 2018-07-03 1:21 ` Wu, Hao A
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox