]> git.proxmox.com Git - mirror_edk2.git/commitdiff
ArmPkg/Gic: Fix boundary checking bug
authorHeyi Guo <heyi.guo@linaro.org>
Sat, 23 Apr 2016 14:39:59 +0000 (22:39 +0800)
committerArd Biesheuvel <ard.biesheuvel@linaro.org>
Mon, 25 Apr 2016 11:28:40 +0000 (13:28 +0200)
mGicNumInterrupts is the total number of interrupts, so the interrupt
ID equal to mGicNumInterrupts is also invalid.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Heyi Guo <heyi.guo@linaro.org>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
ArmPkg/Drivers/ArmGic/ArmGicCommonDxe.c
ArmPkg/Drivers/ArmGic/GicV2/ArmGicV2Dxe.c
ArmPkg/Drivers/ArmGic/GicV3/ArmGicV3Dxe.c

index a9ccef5e1c9a1dde987b9ed8112f34b210606bf7..be77b8361c5af033fd2889cdb48902af867f321d 100644 (file)
@@ -62,7 +62,7 @@ RegisterInterruptSource (
   IN HARDWARE_INTERRUPT_HANDLER         Handler\r
   )\r
 {\r
-  if (Source > mGicNumInterrupts) {\r
+  if (Source >= mGicNumInterrupts) {\r
     ASSERT(FALSE);\r
     return EFI_UNSUPPORTED;\r
   }\r
index e649ac1bc6af6c247db35aa33b4558be33bf7779..036eb5cd6bf6845dd2b03b62c933c1dedaef7251 100644 (file)
@@ -50,7 +50,7 @@ GicV2EnableInterruptSource (
   IN HARDWARE_INTERRUPT_SOURCE          Source\r
   )\r
 {\r
-  if (Source > mGicNumInterrupts) {\r
+  if (Source >= mGicNumInterrupts) {\r
     ASSERT(FALSE);\r
     return EFI_UNSUPPORTED;\r
   }\r
@@ -77,7 +77,7 @@ GicV2DisableInterruptSource (
   IN HARDWARE_INTERRUPT_SOURCE          Source\r
   )\r
 {\r
-  if (Source > mGicNumInterrupts) {\r
+  if (Source >= mGicNumInterrupts) {\r
     ASSERT(FALSE);\r
     return EFI_UNSUPPORTED;\r
   }\r
@@ -106,7 +106,7 @@ GicV2GetInterruptSourceState (
   IN BOOLEAN                            *InterruptState\r
   )\r
 {\r
-  if (Source > mGicNumInterrupts) {\r
+  if (Source >= mGicNumInterrupts) {\r
     ASSERT(FALSE);\r
     return EFI_UNSUPPORTED;\r
   }\r
@@ -134,7 +134,7 @@ GicV2EndOfInterrupt (
   IN HARDWARE_INTERRUPT_SOURCE          Source\r
   )\r
 {\r
-  if (Source > mGicNumInterrupts) {\r
+  if (Source >= mGicNumInterrupts) {\r
     ASSERT(FALSE);\r
     return EFI_UNSUPPORTED;\r
   }\r
index 4afa3d5a09c21abbe307474a1b7a0bd3374445c6..50fa56262eaf3393884665554c7196635240f367 100644 (file)
@@ -40,7 +40,7 @@ GicV3EnableInterruptSource (
   IN HARDWARE_INTERRUPT_SOURCE          Source\r
   )\r
 {\r
-  if (Source > mGicNumInterrupts) {\r
+  if (Source >= mGicNumInterrupts) {\r
     ASSERT(FALSE);\r
     return EFI_UNSUPPORTED;\r
   }\r
@@ -67,7 +67,7 @@ GicV3DisableInterruptSource (
   IN HARDWARE_INTERRUPT_SOURCE          Source\r
   )\r
 {\r
-  if (Source > mGicNumInterrupts) {\r
+  if (Source >= mGicNumInterrupts) {\r
     ASSERT(FALSE);\r
     return EFI_UNSUPPORTED;\r
   }\r
@@ -96,7 +96,7 @@ GicV3GetInterruptSourceState (
   IN BOOLEAN                            *InterruptState\r
   )\r
 {\r
-  if (Source > mGicNumInterrupts) {\r
+  if (Source >= mGicNumInterrupts) {\r
     ASSERT(FALSE);\r
     return EFI_UNSUPPORTED;\r
   }\r
@@ -124,7 +124,7 @@ GicV3EndOfInterrupt (
   IN HARDWARE_INTERRUPT_SOURCE          Source\r
   )\r
 {\r
-  if (Source > mGicNumInterrupts) {\r
+  if (Source >= mGicNumInterrupts) {\r
     ASSERT(FALSE);\r
     return EFI_UNSUPPORTED;\r
   }\r