diff --git a/src/tpm2/NVReserved.c b/src/tpm2/NVReserved.c index cce3ebde..b9332a27 100644 --- a/src/tpm2/NVReserved.c +++ b/src/tpm2/NVReserved.c @@ -172,7 +172,7 @@ NvRead( /* 8.5.3.6 NvWrite() */ /* This function is used to post reserved data for writing to NV memory. Before the TPM completes the operation, the value will be written. */ -void +BOOL NvWrite( UINT32 nvOffset, // IN: location in NV to receive data UINT32 size, // IN: size of the data to move @@ -180,11 +180,13 @@ NvWrite( ) { // Input type should be valid - pAssert(nvOffset + size <= NV_MEMORY_SIZE); - _plat__NvMemoryWrite(nvOffset, size, inBuffer); - // Set the flag that a NV write happened - SET_NV_UPDATE(UT_NV); - return; + if(nvOffset + size <= NV_MEMORY_SIZE) + { + // Set the flag that a NV write happened + SET_NV_UPDATE(UT_NV); + return _plat__NvMemoryWrite(nvOffset, size, inBuffer); + } + return FALSE; } #if 0 // libtpms added being (for Coverity) /* 8.5.3.7 NvUpdatePersistent() */ diff --git a/src/tpm2/NVReserved_fp.h b/src/tpm2/NVReserved_fp.h index 6b1cf898..16bfb20a 100644 --- a/src/tpm2/NVReserved_fp.h +++ b/src/tpm2/NVReserved_fp.h @@ -3,7 +3,7 @@ /* */ /* Written by Ken Goldman */ /* IBM Thomas J. Watson Research Center */ -/* $Id: NVReserved_fp.h 809 2016-11-16 18:31:54Z kgoldman $ */ +/* $Id: NVReserved_fp.h 1476 2019-06-10 19:32:03Z kgoldman $ */ /* */ /* Licenses and Notices */ /* */ @@ -55,7 +55,7 @@ /* arising in any way out of use or reliance upon this specification or any */ /* information herein. */ /* */ -/* (c) Copyright IBM Corp. and others, 2016 */ +/* (c) Copyright IBM Corp. and others, 2016 - 2019 */ /* */ /********************************************************************************/ @@ -86,7 +86,7 @@ NvRead( UINT32 nvOffset, // IN: offset in NV of value UINT32 size // IN: size of the value to read ); -void +BOOL NvWrite( UINT32 nvOffset, // IN: location in NV to receive data UINT32 size, // IN: size of the data to move