diff mbox

[edk2] ArmPkg/ArmGicLib: use correct loop variable

Message ID 1473231890-23205-1-git-send-email-ard.biesheuvel@linaro.org
State Accepted
Commit 92cec05e27d9eafe188da6a19d97bf6509bc164b
Headers show

Commit Message

Ard Biesheuvel Sept. 7, 2016, 7:04 a.m. UTC
The ArmGicLib API function GicGetCpuRedistributorBase () declares
GicCpuRedistributorBase to iterate over the redistributors of all
CPUs, but then inadvertently advances GicRedistributorBase instead.

Reported-by: "Oliyil Kunnil, Vishal" <vishalo@qti.qualcomm.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>

---
 ArmPkg/Drivers/ArmGic/ArmGicLib.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

-- 
2.7.4

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel

Comments

Ard Biesheuvel Sept. 8, 2016, 9:39 a.m. UTC | #1
On 7 September 2016 at 08:04, Ard Biesheuvel <ard.biesheuvel@linaro.org> wrote:
> The ArmGicLib API function GicGetCpuRedistributorBase () declares

> GicCpuRedistributorBase to iterate over the redistributors of all

> CPUs, but then inadvertently advances GicRedistributorBase instead.

>

> Reported-by: "Oliyil Kunnil, Vishal" <vishalo@qti.qualcomm.com>

> Contributed-under: TianoCore Contribution Agreement 1.0

> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>

> ---

>  ArmPkg/Drivers/ArmGic/ArmGicLib.c | 2 +-

>  1 file changed, 1 insertion(+), 1 deletion(-)

>

> diff --git a/ArmPkg/Drivers/ArmGic/ArmGicLib.c b/ArmPkg/Drivers/ArmGic/ArmGicLib.c

> index 73795ed4e56c..e658e9bff5d8 100644

> --- a/ArmPkg/Drivers/ArmGic/ArmGicLib.c

> +++ b/ArmPkg/Drivers/ArmGic/ArmGicLib.c

> @@ -76,7 +76,7 @@ GicGetCpuRedistributorBase (

>      }

>

>      // Move to the next GIC Redistributor frame

> -    GicRedistributorBase += GicRedistributorGranularity;

> +    GicCpuRedistributorBase += GicRedistributorGranularity;

>    }

>

>    // The Redistributor has not been found for the current CPU

> --

> 2.7.4

>


Leif?
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Leif Lindholm Sept. 9, 2016, 3:45 p.m. UTC | #2
On Wed, Sep 07, 2016 at 08:04:50AM +0100, Ard Biesheuvel wrote:
> The ArmGicLib API function GicGetCpuRedistributorBase () declares

> GicCpuRedistributorBase to iterate over the redistributors of all

> CPUs, but then inadvertently advances GicRedistributorBase instead.

> 

> Reported-by: "Oliyil Kunnil, Vishal" <vishalo@qti.qualcomm.com>

> Contributed-under: TianoCore Contribution Agreement 1.0

> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>


Right, so I was contemplating a minor rewrite of the gic driver to
make this sort of thing less likely in the future ... but quickly
realised it wouldn't be a minor one. So:

Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>


> ---

>  ArmPkg/Drivers/ArmGic/ArmGicLib.c | 2 +-

>  1 file changed, 1 insertion(+), 1 deletion(-)

> 

> diff --git a/ArmPkg/Drivers/ArmGic/ArmGicLib.c b/ArmPkg/Drivers/ArmGic/ArmGicLib.c

> index 73795ed4e56c..e658e9bff5d8 100644

> --- a/ArmPkg/Drivers/ArmGic/ArmGicLib.c

> +++ b/ArmPkg/Drivers/ArmGic/ArmGicLib.c

> @@ -76,7 +76,7 @@ GicGetCpuRedistributorBase (

>      }

>  

>      // Move to the next GIC Redistributor frame

> -    GicRedistributorBase += GicRedistributorGranularity;

> +    GicCpuRedistributorBase += GicRedistributorGranularity;

>    }

>  

>    // The Redistributor has not been found for the current CPU

> -- 

> 2.7.4

> 

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
diff mbox

Patch

diff --git a/ArmPkg/Drivers/ArmGic/ArmGicLib.c b/ArmPkg/Drivers/ArmGic/ArmGicLib.c
index 73795ed4e56c..e658e9bff5d8 100644
--- a/ArmPkg/Drivers/ArmGic/ArmGicLib.c
+++ b/ArmPkg/Drivers/ArmGic/ArmGicLib.c
@@ -76,7 +76,7 @@  GicGetCpuRedistributorBase (
     }
 
     // Move to the next GIC Redistributor frame
-    GicRedistributorBase += GicRedistributorGranularity;
+    GicCpuRedistributorBase += GicRedistributorGranularity;
   }
 
   // The Redistributor has not been found for the current CPU