From patchwork Sat Apr 23 14:39:59 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: gary guo X-Patchwork-Id: 66528 Delivered-To: patch@linaro.org Received: by 10.140.93.198 with SMTP id d64csp206134qge; Sat, 23 Apr 2016 07:40:42 -0700 (PDT) X-Received: by 10.66.164.165 with SMTP id yr5mr36246188pab.133.1461422442666; Sat, 23 Apr 2016 07:40:42 -0700 (PDT) Return-Path: Received: from ml01.01.org (ml01.01.org. [2001:19d0:306:5::1]) by mx.google.com with ESMTPS id pv8si14613968pac.134.2016.04.23.07.40.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 23 Apr 2016 07:40:42 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) client-ip=2001:19d0:306:5::1; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE dis=NONE) header.from=linaro.org Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 6E4381A2032; Sat, 23 Apr 2016 07:40:41 -0700 (PDT) X-Original-To: edk2-devel@lists.01.org Delivered-To: edk2-devel@lists.01.org Received: from mail-oi0-x22c.google.com (mail-oi0-x22c.google.com [IPv6:2607:f8b0:4003:c06::22c]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id D4D2C1A1F75 for ; Sat, 23 Apr 2016 07:40:40 -0700 (PDT) Received: by mail-oi0-x22c.google.com with SMTP id r78so141661350oie.0 for ; Sat, 23 Apr 2016 07:40:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=TAFf7wNqYkdVmynyr9TJ3mr3AB9tiqtchGj548eD/m8=; b=iS1tEtEFqx+XNOx2G5VF9yntN1HGxZbQAO1Jh0dwQkr6sakbXZB/DVZIQv/ieQ+k7C 2CNG5swvqD8daeuZV37iAqLsUJIguQm2kOQ3WzzeUs2w+albWbBsQr1dyWiFaL7/zM1/ IO2pYAjsCUYh7msQ2hrRaJQJjF3/R5HoWp2M4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=TAFf7wNqYkdVmynyr9TJ3mr3AB9tiqtchGj548eD/m8=; b=SSyr50IhzmAiIrmQfL8CZH5xa5Q3bcmMewtwouy6H2W0gtzsE4Y90ZiJNkJPbjpBgX +3XmYctjGrQxJEWuvQcIFmmGAgzsGzSwygmriqC2dxe9miUpvjR5f1Y5eXBYxicqSKuB 37IORtHkt+zXPFuTUyd9jwwHgGCA5DomqKYgUmRRrxZFsCopMDGDtKeFKhZJYpfLwNx+ GEpr+sPyBaXqxuujyooXK0uCesJ5JNFq2Kja/8TdFE2k2VaOwavIAvWuXebRgVh6VugP IPvw5JeAxFhCLWXyDt3gUrVt9kkDHkXGc8N3jm86j0De+1Fs1Mck16LzPbkWfy5v4gOI RCqQ== X-Gm-Message-State: AOPr4FVLWONOi0YSphRU+7im4Dlp3K/GShmztMDIhT2Qw/pU+vk7Wy7G/RgG9zDBGiIjLYTS X-Received: by 10.202.97.66 with SMTP id v63mr10514133oib.14.1461422439973; Sat, 23 Apr 2016 07:40:39 -0700 (PDT) Received: from localhost.localdomain ([104.238.32.50]) by smtp.gmail.com with ESMTPSA id p1sm3655369obn.22.2016.04.23.07.40.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 23 Apr 2016 07:40:39 -0700 (PDT) From: Heyi Guo To: edk2-devel@lists.01.org Date: Sat, 23 Apr 2016 22:39:59 +0800 Message-Id: <1461422399-19791-1-git-send-email-heyi.guo@linaro.org> X-Mailer: git-send-email 2.7.0 Subject: [edk2] [PATCH] ArmPkg/Gic: Fix boundary checking bug X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Heyi Guo , Leif Lindholm , Ard Biesheuvel MIME-Version: 1.0 Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" 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 Cc: Leif Lindholm Cc: Ard Biesheuvel --- ArmPkg/Drivers/ArmGic/ArmGicCommonDxe.c | 2 +- ArmPkg/Drivers/ArmGic/GicV2/ArmGicV2Dxe.c | 8 ++++---- ArmPkg/Drivers/ArmGic/GicV3/ArmGicV3Dxe.c | 8 ++++---- 3 files changed, 9 insertions(+), 9 deletions(-) -- 2.7.0 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel Reviewed-by: Ard Biesheuvel diff --git a/ArmPkg/Drivers/ArmGic/ArmGicCommonDxe.c b/ArmPkg/Drivers/ArmGic/ArmGicCommonDxe.c index a9ccef5..be77b83 100644 --- a/ArmPkg/Drivers/ArmGic/ArmGicCommonDxe.c +++ b/ArmPkg/Drivers/ArmGic/ArmGicCommonDxe.c @@ -62,7 +62,7 @@ RegisterInterruptSource ( IN HARDWARE_INTERRUPT_HANDLER Handler ) { - if (Source > mGicNumInterrupts) { + if (Source >= mGicNumInterrupts) { ASSERT(FALSE); return EFI_UNSUPPORTED; } diff --git a/ArmPkg/Drivers/ArmGic/GicV2/ArmGicV2Dxe.c b/ArmPkg/Drivers/ArmGic/GicV2/ArmGicV2Dxe.c index e649ac1..036eb5c 100644 --- a/ArmPkg/Drivers/ArmGic/GicV2/ArmGicV2Dxe.c +++ b/ArmPkg/Drivers/ArmGic/GicV2/ArmGicV2Dxe.c @@ -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; } diff --git a/ArmPkg/Drivers/ArmGic/GicV3/ArmGicV3Dxe.c b/ArmPkg/Drivers/ArmGic/GicV3/ArmGicV3Dxe.c index 4afa3d5..50fa562 100644 --- a/ArmPkg/Drivers/ArmGic/GicV3/ArmGicV3Dxe.c +++ b/ArmPkg/Drivers/ArmGic/GicV3/ArmGicV3Dxe.c @@ -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; }