]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Fix parameter checking for CPU I/O 2 Protocol on NT32 platform.
authorxli24 <xli24@6f19259b-4bc3-4df7-8a09-765794883524>
Thu, 14 Jan 2010 09:07:47 +0000 (09:07 +0000)
committerxli24 <xli24@6f19259b-4bc3-4df7-8a09-765794883524>
Thu, 14 Jan 2010 09:07:47 +0000 (09:07 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9750 6f19259b-4bc3-4df7-8a09-765794883524

Nt32Pkg/CpuRuntimeDxe/CpuIo.c

index e4f056ceda0006d72bac4e128428bd4e17c9d746..272a8d7b6bf98e3f31c8c705dcf49be82edb4042 100644 (file)
@@ -1,6 +1,6 @@
 /**@file\r
 \r
 /**@file\r
 \r
-Copyright (c) 2006 - 2009, Intel Corporation                                                         \r
+Copyright (c) 2006 - 2010, Intel Corporation                                                         \r
 All rights reserved. This program and the accompanying materials                          \r
 are licensed and made available under the terms and conditions of the BSD License         \r
 which accompanies this distribution.  The full text of the license may be found at        \r
 All rights reserved. This program and the accompanying materials                          \r
 are licensed and made available under the terms and conditions of the BSD License         \r
 which accompanies this distribution.  The full text of the license may be found at        \r
@@ -81,6 +81,10 @@ Returns:
     return EFI_INVALID_PARAMETER;\r
   }\r
 \r
     return EFI_INVALID_PARAMETER;\r
   }\r
 \r
+  if ((Width < 0) || (Width >= EfiCpuIoWidthMaximum)) {\r
+    return EFI_INVALID_PARAMETER;\r
+  }\r
+\r
   Status = CpuIoCheckAddressRange (Width, Address, Count, Buffer, IA32_MAX_MEM_ADDRESS);\r
   if (EFI_ERROR (Status)) {\r
     return Status;\r
   Status = CpuIoCheckAddressRange (Width, Address, Count, Buffer, IA32_MAX_MEM_ADDRESS);\r
   if (EFI_ERROR (Status)) {\r
     return Status;\r
@@ -135,6 +139,10 @@ Returns:
     return EFI_INVALID_PARAMETER;\r
   }\r
 \r
     return EFI_INVALID_PARAMETER;\r
   }\r
 \r
+  if ((Width < 0) || (Width >= EfiCpuIoWidthMaximum)) {\r
+    return EFI_INVALID_PARAMETER;\r
+  }\r
+\r
   Status = CpuIoCheckAddressRange (Width, Address, Count, Buffer, IA32_MAX_MEM_ADDRESS);\r
   if (EFI_ERROR (Status)) {\r
     return Status;\r
   Status = CpuIoCheckAddressRange (Width, Address, Count, Buffer, IA32_MAX_MEM_ADDRESS);\r
   if (EFI_ERROR (Status)) {\r
     return Status;\r
@@ -192,7 +200,7 @@ Returns:
 \r
   Address = (UINTN) UserAddress;\r
 \r
 \r
   Address = (UINTN) UserAddress;\r
 \r
-  if (Width >= EfiCpuIoWidthMaximum) {\r
+  if ((Width < 0) || (Width >= EfiCpuIoWidthMaximum)) {\r
     return EFI_INVALID_PARAMETER;\r
   }\r
 \r
     return EFI_INVALID_PARAMETER;\r
   }\r
 \r
@@ -257,7 +265,7 @@ Returns:
 \r
   Address = (UINTN) UserAddress;\r
 \r
 \r
   Address = (UINTN) UserAddress;\r
 \r
-  if (Width >= EfiCpuIoWidthMaximum) {\r
+  if ((Width < 0) || (Width >= EfiCpuIoWidthMaximum)) {\r
     return EFI_INVALID_PARAMETER;\r
   }\r
 \r
     return EFI_INVALID_PARAMETER;\r
   }\r
 \r