X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=MdeModulePkg%2FUniversal%2FNetwork%2FSnpDxe%2FNvdata.c;h=443979087e59c56ea87b7ae34df1c7d6a4b7c279;hb=c9325700d0ef25eaf45077928af3f93b15ac5fe0;hp=4b9259f87a0d48bb51155504e085e5a7ba508e13;hpb=4cda7726e5fd30aaf3e05c80207ae1b264bfa123;p=mirror_edk2.git diff --git a/MdeModulePkg/Universal/Network/SnpDxe/Nvdata.c b/MdeModulePkg/Universal/Network/SnpDxe/Nvdata.c index 4b9259f87a..443979087e 100644 --- a/MdeModulePkg/Universal/Network/SnpDxe/Nvdata.c +++ b/MdeModulePkg/Universal/Network/SnpDxe/Nvdata.c @@ -1,9 +1,9 @@ /** @file - Implementation of reading and writing operations on the NVRAM device - attached to a network interface. + Implementation of reading and writing operations on the NVRAM device + attached to a network interface. -Copyright (c) 2004 - 2007, Intel Corporation.
-All rights reserved. This program and the accompanying materials are licensed +Copyright (c) 2004 - 2009, 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 http://opensource.org/licenses/bsd-license.php @@ -24,6 +24,10 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. @param BufferSize number of bytes to read @param Buffer pointer where to read into + @retval EFI_SUCCESS The NVRAM access was performed. + @retval EFI_INVALID_PARAMETER Invalid UNDI command. + @retval EFI_UNSUPPORTED Command is not supported by UNDI. + @retval EFI_DEVICE_ERROR Fail to execute UNDI command. **/ EFI_STATUS @@ -44,7 +48,7 @@ PxeNvDataRead ( Snp->Cdb.CPBsize = PXE_CPBSIZE_NOT_USED; Snp->Cdb.CPBaddr = PXE_CPBADDR_NOT_USED; - Snp->Cdb.DBsize = sizeof (PXE_DB_NVDATA); + Snp->Cdb.DBsize = (UINT16) sizeof (PXE_DB_NVDATA); Snp->Cdb.DBaddr = (UINT64)(UINTN) Db; Snp->Cdb.StatCode = PXE_STATCODE_INITIALIZE; @@ -84,7 +88,9 @@ PxeNvDataRead ( return EFI_DEVICE_ERROR; } - CopyMem (Buffer, Db->Data.Byte + Offset, BufferSize); + ASSERT (Offset < sizeof (Db->Data)); + + CopyMem (Buffer, &Db->Data.Byte[Offset], BufferSize); return EFI_SUCCESS; }