Re: [edk2] [PATCH] MdeModulePkg SataControllerDxe: Use compare logic in if condition

2018-07-02 Thread Wu, Hao A
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
> 
> Good idea, I agree.
> 
> 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
> 
> 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-boun...@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 = 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
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH] MdeModulePkg SataControllerDxe: Use compare logic in if condition

2018-07-02 Thread 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 ; edk2-devel@lists.01.org
Cc: Bi, Dandan ; Zeng, Star 
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-boun...@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 = 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
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH] MdeModulePkg SataControllerDxe: Use compare logic in if condition

2018-07-02 Thread Wu, Hao A
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-boun...@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 = 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
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH] MdeModulePkg SataControllerDxe: Use compare logic in if condition

2018-07-02 Thread Bi, Dandan
Reviewed-by: Dandan Bi 

Thanks,
Dandan

-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@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 ; 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 = 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
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [PATCH] MdeModulePkg SataControllerDxe: Use compare logic in if condition

2018-07-02 Thread Star Zeng
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 = 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