From 9c1d98d822a9cd2146790d146c3ddd053b9cc759 Mon Sep 17 00:00:00 2001 From: xli24 Date: Thu, 14 Jan 2010 09:07:47 +0000 Subject: [PATCH] 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 --- Nt32Pkg/CpuRuntimeDxe/CpuIo.c | 14 +++++++++++--- 1 file 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; } -- 2.39.2