From 02edee8a87794caa86d68881a2bb8f27840ef0b1 Mon Sep 17 00:00:00 2001 From: vit9696 Date: Sat, 13 Apr 2019 21:49:44 +0300 Subject: [PATCH] OcDebugLogLib: Verify OcLog protocol revision --- Include/Protocol/OcLog.h | 8 +++++++- Library/OcDebugLogLib/OcDebugLogLib.c | 2 +- Library/OcDebugLogLib/OcLogInternal.h | 1 - 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/Include/Protocol/OcLog.h b/Include/Protocol/OcLog.h index 18627971..623b2033 100755 --- a/Include/Protocol/OcLog.h +++ b/Include/Protocol/OcLog.h @@ -15,8 +15,14 @@ #ifndef OC_LOG_PROTOCOL_H #define OC_LOG_PROTOCOL_H -// The defines for the log flags. +/// +/// Current supported log protocol revision. +/// +#define OC_LOG_REVISION 0x01000A +/// +/// The defines for the log flags. +/// #define OC_LOG_DISABLE 0 #define OC_LOG_ENABLE BIT0 #define OC_LOG_CONSOLE BIT1 diff --git a/Library/OcDebugLogLib/OcDebugLogLib.c b/Library/OcDebugLogLib/OcDebugLogLib.c index e8321dda..83f94987 100755 --- a/Library/OcDebugLogLib/OcDebugLogLib.c +++ b/Library/OcDebugLogLib/OcDebugLogLib.c @@ -65,7 +65,7 @@ DebugPrint ( (VOID **) &mOcLog ); - if (EFI_ERROR (Status)) { + if (EFI_ERROR (Status) || mOcLog->Revision != OC_LOG_REVISION) { mOcLog = NULL; } } diff --git a/Library/OcDebugLogLib/OcLogInternal.h b/Library/OcDebugLogLib/OcLogInternal.h index abf5d2d9..ab515d00 100755 --- a/Library/OcDebugLogLib/OcLogInternal.h +++ b/Library/OcDebugLogLib/OcLogInternal.h @@ -18,7 +18,6 @@ #include #include -#define OC_LOG_REVISION 0x01000A #define OC_LOG_BUFFER_SIZE BASE_512KB #define OC_LOG_LINE_BUFFER_SIZE BASE_1KB #define OC_LOG_FILE_PATH_BUFFER_SIZE 256