From 18ad26da318b11bd6be78ea751bc07bfa6f441eb Mon Sep 17 00:00:00 2001 From: ydong10 Date: Tue, 21 Jun 2011 02:24:46 +0000 Subject: [PATCH] Initialize data before using it Signed-off-by: ydong10 Reviewed-by: lgao4 git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11869 6f19259b-4bc3-4df7-8a09-765794883524 --- MdePkg/Library/DxeIoLibEsal/IoLib.c | 4 ++++ MdePkg/Library/DxeSalLibEsal/DxeSalLibEsal.c | 9 ++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/MdePkg/Library/DxeIoLibEsal/IoLib.c b/MdePkg/Library/DxeIoLibEsal/IoLib.c index 7bc6ff1b61..81b28ecdd9 100644 --- a/MdePkg/Library/DxeIoLibEsal/IoLib.c +++ b/MdePkg/Library/DxeIoLibEsal/IoLib.c @@ -38,6 +38,8 @@ IoReadWorker ( SAL_RETURN_REGS ReturnReg; UINT64 Data; + Data = 0; + ReturnReg = EsalCall ( EFI_EXTENDED_SAL_BASE_IO_SERVICES_PROTOCOL_GUID_LO, EFI_EXTENDED_SAL_BASE_IO_SERVICES_PROTOCOL_GUID_HI, @@ -119,6 +121,8 @@ MmioReadWorker ( SAL_RETURN_REGS ReturnReg; UINT64 Data; + Data = 0; + ReturnReg = EsalCall ( EFI_EXTENDED_SAL_BASE_IO_SERVICES_PROTOCOL_GUID_LO, EFI_EXTENDED_SAL_BASE_IO_SERVICES_PROTOCOL_GUID_HI, diff --git a/MdePkg/Library/DxeSalLibEsal/DxeSalLibEsal.c b/MdePkg/Library/DxeSalLibEsal/DxeSalLibEsal.c index b013146eb2..8d1dd9ae15 100644 --- a/MdePkg/Library/DxeSalLibEsal/DxeSalLibEsal.c +++ b/MdePkg/Library/DxeSalLibEsal/DxeSalLibEsal.c @@ -59,6 +59,14 @@ SalCall ( ) { SAL_RETURN_REGS Regs; + + // + // Initial all members in this structure. + // + Regs.r9 = 0; + Regs.r10 = 0; + Regs.r11 = 0; + Regs.Status = EFI_SAL_INVALID_ARGUMENT; switch (Index) { case EFI_SAL_SET_VECTORS: @@ -272,7 +280,6 @@ SalCall ( break; default: - Regs.Status = EFI_SAL_INVALID_ARGUMENT; return Regs; break; }