MdeModulePkg/ReportStatusCodeRouter: Clear RSC Data buffer if Data is NULL

REF:https://bugzilla.tianocore.org/show_bug.cgi?id=1969

ReportDispatcher() may be invoked with a NULL Data argument. When TPL is
less than TPL_HIGH_LEVEL and Data is NULL, the EFI_STATUS_CODE_DATA
structure inside RscData should be cleared so listeners will not receive
data from a previous operation.

Cc: Hao A Wu <hao.a.wu@intel.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Kun Qin <Kun.Qin@microsoft.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Reviewed-by: Dandan Bi <dandan.bi@intel.com>
This commit is contained in:
Michael Kubacki 2020-04-09 06:11:59 +08:00 committed by mergify[bot]
parent be7295b364
commit 7a7bedce25
1 changed files with 4 additions and 0 deletions

View File

@ -3,6 +3,7 @@
and Status Code Runtime Protocol.
Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>
Copyright (c) Microsoft Corporation.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
@ -307,6 +308,9 @@ ReportDispatcher (
}
if (Data != NULL) {
CopyMem (&RscData->Data, Data, Data->HeaderSize + Data->Size);
} else {
ZeroMem (&RscData->Data, sizeof (RscData->Data));
RscData->Data.HeaderSize = sizeof (RscData->Data);
}
Status = gBS->SignalEvent (CallbackEntry->Event);