From 9a2d4fe9a7650097e5ef27366efbf3a14326f5b5 Mon Sep 17 00:00:00 2001 From: xli24 Date: Sat, 21 Jun 2008 11:16:36 +0000 Subject: Add parameter checking for PCI IO protocol according to UEFI spec. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@5359 6f19259b-4bc3-4df7-8a09-765794883524 --- IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciIo.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'IntelFrameworkModulePkg') diff --git a/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciIo.c b/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciIo.c index ccec7d7244..eabbe4989b 100644 --- a/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciIo.c +++ b/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciIo.c @@ -1,7 +1,7 @@ /**@file Implement all interfaces for EFI_PCI_IO_PROTOCOL. -Copyright (c) 2006, Intel Corporation +Copyright (c) 2006 - 2008, 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 @@ -379,6 +379,10 @@ PciIoMemRead ( return EFI_INVALID_PARAMETER; } + if (Buffer == NULL) { + return EFI_INVALID_PARAMETER; + } + Status = PciIoVerifyBarAccess (PciIoDevice, BarIndex, PciBarTypeMem, Width, Count, &Offset); if (EFI_ERROR (Status)) { return EFI_UNSUPPORTED; @@ -439,6 +443,10 @@ PciIoMemWrite ( return EFI_INVALID_PARAMETER; } + if (Buffer == NULL) { + return EFI_INVALID_PARAMETER; + } + Status = PciIoVerifyBarAccess (PciIoDevice, BarIndex, PciBarTypeMem, Width, Count, &Offset); if (EFI_ERROR (Status)) { return EFI_UNSUPPORTED; @@ -499,6 +507,10 @@ PciIoIoRead ( return EFI_INVALID_PARAMETER; } + if (Buffer == NULL) { + return EFI_INVALID_PARAMETER; + } + Status = PciIoVerifyBarAccess (PciIoDevice, BarIndex, PciBarTypeIo, Width, Count, &Offset); if (EFI_ERROR (Status)) { return EFI_UNSUPPORTED; @@ -559,6 +571,10 @@ PciIoIoWrite ( return EFI_INVALID_PARAMETER; } + if (Buffer == NULL) { + return EFI_INVALID_PARAMETER; + } + Status = PciIoVerifyBarAccess (PciIoDevice, BarIndex, PciBarTypeIo, Width, Count, &Offset); if (EFI_ERROR (Status)) { return EFI_UNSUPPORTED; -- cgit v1.2.3