From 3f5c168fa8bdff5e4acfbf547eb9d0dcbb5dd534 Mon Sep 17 00:00:00 2001 From: lzeng14 Date: Wed, 12 Dec 2012 14:12:49 +0000 Subject: Use SMM_VARIABLE_COMMUNICATE_HEADER_SIZE instead of OFFSET_OF (SMM_VARIABLE_COMMUNICATE_HEADER, Data). Signed-off-by: Star Zeng Reviewed-by: Ting Ye git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13993 6f19259b-4bc3-4df7-8a09-765794883524 --- MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.c | 10 +++++----- SecurityPkg/VariableAuthenticated/RuntimeDxe/VariableSmm.c | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.c b/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.c index 15e55d4..550f01a 100644 --- a/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.c +++ b/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.c @@ -445,7 +445,7 @@ SmmVariableHandler ( // // SMRAM range check already covered before // - if (InfoSize > *CommBufferSize - OFFSET_OF (SMM_VARIABLE_COMMUNICATE_HEADER, Data)) { + if (InfoSize > *CommBufferSize - SMM_VARIABLE_COMMUNICATE_HEADER_SIZE) { DEBUG ((EFI_D_ERROR, "Data size exceed communication buffer size limit!\n")); Status = EFI_ACCESS_DENIED; goto EXIT; @@ -467,7 +467,7 @@ SmmVariableHandler ( // // SMRAM range check already covered before // - if (InfoSize > *CommBufferSize - OFFSET_OF (SMM_VARIABLE_COMMUNICATE_HEADER, Data)) { + if (InfoSize > *CommBufferSize - SMM_VARIABLE_COMMUNICATE_HEADER_SIZE) { DEBUG ((EFI_D_ERROR, "Data size exceed communication buffer size limit!\n")); Status = EFI_ACCESS_DENIED; goto EXIT; @@ -498,7 +498,7 @@ SmmVariableHandler ( // // SMRAM range check already covered before // - if (InfoSize > *CommBufferSize - OFFSET_OF (SMM_VARIABLE_COMMUNICATE_HEADER, Data)) { + if (InfoSize > *CommBufferSize - SMM_VARIABLE_COMMUNICATE_HEADER_SIZE) { DEBUG ((EFI_D_ERROR, "Data size exceed communication buffer size limit!\n")); Status = EFI_ACCESS_DENIED; goto EXIT; @@ -528,7 +528,7 @@ SmmVariableHandler ( case SMM_VARIABLE_FUNCTION_GET_STATISTICS: VariableInfo = (VARIABLE_INFO_ENTRY *) SmmVariableFunctionHeader->Data; - InfoSize = *CommBufferSize - OFFSET_OF (SMM_VARIABLE_COMMUNICATE_HEADER, Data); + InfoSize = *CommBufferSize - SMM_VARIABLE_COMMUNICATE_HEADER_SIZE; // // Do not need to check SmmVariableFunctionHeader->Data in SMRAM here. @@ -542,7 +542,7 @@ SmmVariableHandler ( } Status = SmmVariableGetStatistics (VariableInfo, &InfoSize); - *CommBufferSize = InfoSize + OFFSET_OF (SMM_VARIABLE_COMMUNICATE_HEADER, Data); + *CommBufferSize = InfoSize + SMM_VARIABLE_COMMUNICATE_HEADER_SIZE; break; default: diff --git a/SecurityPkg/VariableAuthenticated/RuntimeDxe/VariableSmm.c b/SecurityPkg/VariableAuthenticated/RuntimeDxe/VariableSmm.c index c8ee79a..316845f 100644 --- a/SecurityPkg/VariableAuthenticated/RuntimeDxe/VariableSmm.c +++ b/SecurityPkg/VariableAuthenticated/RuntimeDxe/VariableSmm.c @@ -451,7 +451,7 @@ SmmVariableHandler ( // // SMRAM range check already covered before // - if (InfoSize > *CommBufferSize - OFFSET_OF (SMM_VARIABLE_COMMUNICATE_HEADER, Data)) { + if (InfoSize > *CommBufferSize - SMM_VARIABLE_COMMUNICATE_HEADER_SIZE) { DEBUG ((EFI_D_ERROR, "Data size exceed communication buffer size limit!\n")); Status = EFI_ACCESS_DENIED; goto EXIT; @@ -473,7 +473,7 @@ SmmVariableHandler ( // // SMRAM range check already covered before // - if (InfoSize > *CommBufferSize - OFFSET_OF (SMM_VARIABLE_COMMUNICATE_HEADER, Data)) { + if (InfoSize > *CommBufferSize - SMM_VARIABLE_COMMUNICATE_HEADER_SIZE) { DEBUG ((EFI_D_ERROR, "Data size exceed communication buffer size limit!\n")); Status = EFI_ACCESS_DENIED; goto EXIT; @@ -504,7 +504,7 @@ SmmVariableHandler ( // // SMRAM range check already covered before // - if (InfoSize > *CommBufferSize - OFFSET_OF (SMM_VARIABLE_COMMUNICATE_HEADER, Data)) { + if (InfoSize > *CommBufferSize - SMM_VARIABLE_COMMUNICATE_HEADER_SIZE) { DEBUG ((EFI_D_ERROR, "Data size exceed communication buffer size limit!\n")); Status = EFI_ACCESS_DENIED; goto EXIT; @@ -534,7 +534,7 @@ SmmVariableHandler ( case SMM_VARIABLE_FUNCTION_GET_STATISTICS: VariableInfo = (VARIABLE_INFO_ENTRY *) SmmVariableFunctionHeader->Data; - InfoSize = *CommBufferSize - OFFSET_OF (SMM_VARIABLE_COMMUNICATE_HEADER, Data); + InfoSize = *CommBufferSize - SMM_VARIABLE_COMMUNICATE_HEADER_SIZE; // // Do not need to check SmmVariableFunctionHeader->Data in SMRAM here. @@ -548,7 +548,7 @@ SmmVariableHandler ( } Status = SmmVariableGetStatistics (VariableInfo, &InfoSize); - *CommBufferSize = InfoSize + OFFSET_OF (SMM_VARIABLE_COMMUNICATE_HEADER, Data); + *CommBufferSize = InfoSize + SMM_VARIABLE_COMMUNICATE_HEADER_SIZE; break; default: -- cgit v1.1