EmbeddedPkg/NonCoherentDmaLib: Avoid dereferencing unset Map field

Map->Operation is used to select whether a DMA region that
is being bounced has the source buffer copied to it. Except
Map->Operation isn't yet set, so the behavior is somewhat
random. Instead use the passed in Operation parameter.

Signed-off-by: Jeremy Linton <jeremy.linton@arm.com>
Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
This commit is contained in:
Jeremy Linton 2021-08-13 00:05:08 -05:00 committed by mergify[bot]
parent 6fdd1c13a7
commit ef56f55d19
1 changed files with 1 additions and 1 deletions

View File

@ -224,7 +224,7 @@ DmaMap (
goto FreeMapInfo;
}
if (Map->Operation == MapOperationBusMasterRead) {
if (Operation == MapOperationBusMasterRead) {
CopyMem (Map->BufferAddress, (VOID *)(UINTN)HostAddress, *NumberOfBytes);
}
mCpu->FlushDataCache (mCpu, (UINTN)Map->BufferAddress, AllocSize,