summaryrefslogtreecommitdiff
path: root/Nt32Pkg
diff options
context:
space:
mode:
authorxli24 <xli24@6f19259b-4bc3-4df7-8a09-765794883524>2010-01-14 09:07:47 +0000
committerxli24 <xli24@6f19259b-4bc3-4df7-8a09-765794883524>2010-01-14 09:07:47 +0000
commit9c1d98d822a9cd2146790d146c3ddd053b9cc759 (patch)
tree65d5c6d0e810806273f3b3293adb0e3e99a067d7 /Nt32Pkg
parent7e28c19670ae099ce87e885c047412b5d1d221d7 (diff)
downloadedk2-platforms-9c1d98d822a9cd2146790d146c3ddd053b9cc759.tar.xz
Fix parameter checking for CPU I/O 2 Protocol on NT32 platform.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9750 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'Nt32Pkg')
-rw-r--r--Nt32Pkg/CpuRuntimeDxe/CpuIo.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/Nt32Pkg/CpuRuntimeDxe/CpuIo.c b/Nt32Pkg/CpuRuntimeDxe/CpuIo.c
index e4f056ceda..272a8d7b6b 100644
--- a/Nt32Pkg/CpuRuntimeDxe/CpuIo.c
+++ b/Nt32Pkg/CpuRuntimeDxe/CpuIo.c
@@ -1,6 +1,6 @@
/**@file
-Copyright (c) 2006 - 2009, Intel Corporation
+Copyright (c) 2006 - 2010, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -81,6 +81,10 @@ Returns:
return EFI_INVALID_PARAMETER;
}
+ if ((Width < 0) || (Width >= EfiCpuIoWidthMaximum)) {
+ return EFI_INVALID_PARAMETER;
+ }
+
Status = CpuIoCheckAddressRange (Width, Address, Count, Buffer, IA32_MAX_MEM_ADDRESS);
if (EFI_ERROR (Status)) {
return Status;
@@ -135,6 +139,10 @@ Returns:
return EFI_INVALID_PARAMETER;
}
+ if ((Width < 0) || (Width >= EfiCpuIoWidthMaximum)) {
+ return EFI_INVALID_PARAMETER;
+ }
+
Status = CpuIoCheckAddressRange (Width, Address, Count, Buffer, IA32_MAX_MEM_ADDRESS);
if (EFI_ERROR (Status)) {
return Status;
@@ -192,7 +200,7 @@ Returns:
Address = (UINTN) UserAddress;
- if (Width >= EfiCpuIoWidthMaximum) {
+ if ((Width < 0) || (Width >= EfiCpuIoWidthMaximum)) {
return EFI_INVALID_PARAMETER;
}
@@ -257,7 +265,7 @@ Returns:
Address = (UINTN) UserAddress;
- if (Width >= EfiCpuIoWidthMaximum) {
+ if ((Width < 0) || (Width >= EfiCpuIoWidthMaximum)) {
return EFI_INVALID_PARAMETER;
}