ArmPkg/Gic: Fix boundary checking bug

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>
This commit is contained in:
Heyi Guo 2016-04-23 22:39:59 +08:00 committed by Ard Biesheuvel
parent fa8ee0ad6d
commit 599f004b27
3 changed files with 9 additions and 9 deletions

View File

@ -62,7 +62,7 @@ RegisterInterruptSource (
IN HARDWARE_INTERRUPT_HANDLER Handler
)
{
if (Source > mGicNumInterrupts) {
if (Source >= mGicNumInterrupts) {
ASSERT(FALSE);
return EFI_UNSUPPORTED;
}

View File

@ -50,7 +50,7 @@ GicV2EnableInterruptSource (
IN HARDWARE_INTERRUPT_SOURCE Source
)
{
if (Source > mGicNumInterrupts) {
if (Source >= mGicNumInterrupts) {
ASSERT(FALSE);
return EFI_UNSUPPORTED;
}
@ -77,7 +77,7 @@ GicV2DisableInterruptSource (
IN HARDWARE_INTERRUPT_SOURCE Source
)
{
if (Source > mGicNumInterrupts) {
if (Source >= mGicNumInterrupts) {
ASSERT(FALSE);
return EFI_UNSUPPORTED;
}
@ -106,7 +106,7 @@ GicV2GetInterruptSourceState (
IN BOOLEAN *InterruptState
)
{
if (Source > mGicNumInterrupts) {
if (Source >= mGicNumInterrupts) {
ASSERT(FALSE);
return EFI_UNSUPPORTED;
}
@ -134,7 +134,7 @@ GicV2EndOfInterrupt (
IN HARDWARE_INTERRUPT_SOURCE Source
)
{
if (Source > mGicNumInterrupts) {
if (Source >= mGicNumInterrupts) {
ASSERT(FALSE);
return EFI_UNSUPPORTED;
}

View File

@ -40,7 +40,7 @@ GicV3EnableInterruptSource (
IN HARDWARE_INTERRUPT_SOURCE Source
)
{
if (Source > mGicNumInterrupts) {
if (Source >= mGicNumInterrupts) {
ASSERT(FALSE);
return EFI_UNSUPPORTED;
}
@ -67,7 +67,7 @@ GicV3DisableInterruptSource (
IN HARDWARE_INTERRUPT_SOURCE Source
)
{
if (Source > mGicNumInterrupts) {
if (Source >= mGicNumInterrupts) {
ASSERT(FALSE);
return EFI_UNSUPPORTED;
}
@ -96,7 +96,7 @@ GicV3GetInterruptSourceState (
IN BOOLEAN *InterruptState
)
{
if (Source > mGicNumInterrupts) {
if (Source >= mGicNumInterrupts) {
ASSERT(FALSE);
return EFI_UNSUPPORTED;
}
@ -124,7 +124,7 @@ GicV3EndOfInterrupt (
IN HARDWARE_INTERRUPT_SOURCE Source
)
{
if (Source > mGicNumInterrupts) {
if (Source >= mGicNumInterrupts) {
ASSERT(FALSE);
return EFI_UNSUPPORTED;
}