From aff463c825a3bd46f2e82cc81b6ec959e705f8e9 Mon Sep 17 00:00:00 2001 From: Laszlo Ersek Date: Thu, 18 May 2017 23:04:27 +0800 Subject: [PATCH] Vlv2TbltDevicePkg/FvbRuntimeDxe: correct NumOfLba vararg type in EraseBlocks() According to the PI spec, Volume 3, EFI_FIRMWARE_VOLUME_BLOCK2_PROTOCOL.EraseBlocks(): > The variable argument list is a list of tuples. Each tuple describes a > range of LBAs to erase and consists of the following: > * An EFI_LBA that indicates the starting LBA > * A UINTN that indicates the number of blocks to erase (NB, in edk2, EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL is a typedef to EFI_FIRMWARE_VOLUME_BLOCK2_PROTOCOL.) In this driver, the NumOfLba local variable is defined with type UINTN, but the TYPE argument passed to VA_ARG() is UINT32. Fix the mismatch. Cc: David Wei Cc: Jordan Justen Cc: Mang Guo Reported-by: Jordan Justen Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek --- Vlv2TbltDevicePkg/FvbRuntimeDxe/FvbService.c | 4 ++-- Vlv2TbltDevicePkg/FvbRuntimeDxe/FvbSmmDxe.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Vlv2TbltDevicePkg/FvbRuntimeDxe/FvbService.c b/Vlv2TbltDevicePkg/FvbRuntimeDxe/FvbService.c index b0013f9183..89b9410424 100644 --- a/Vlv2TbltDevicePkg/FvbRuntimeDxe/FvbService.c +++ b/Vlv2TbltDevicePkg/FvbRuntimeDxe/FvbService.c @@ -793,7 +793,7 @@ FvbProtocolEraseBlocks ( break; } - NumOfLba = VA_ARG (args, UINT32); + NumOfLba = VA_ARG (args, UINTN); // // Check input parameters. @@ -817,7 +817,7 @@ FvbProtocolEraseBlocks ( break; } - NumOfLba = VA_ARG (args, UINT32); + NumOfLba = VA_ARG (args, UINTN); while ( NumOfLba > 0 ) { Status = FvbEraseBlock (FvbDevice->Instance, StartingLba); diff --git a/Vlv2TbltDevicePkg/FvbRuntimeDxe/FvbSmmDxe.c b/Vlv2TbltDevicePkg/FvbRuntimeDxe/FvbSmmDxe.c index 20aaf8720f..22a4bdcdd4 100644 --- a/Vlv2TbltDevicePkg/FvbRuntimeDxe/FvbSmmDxe.c +++ b/Vlv2TbltDevicePkg/FvbRuntimeDxe/FvbSmmDxe.c @@ -725,7 +725,7 @@ FvbEraseBlocks ( break; } - NumOfLba = VA_ARG (Marker, UINT32); + NumOfLba = VA_ARG (Marker, UINTN); if (NumOfLba == 0) { return EFI_INVALID_PARAMETER; } @@ -742,7 +742,7 @@ FvbEraseBlocks ( if (StartingLba == EFI_LBA_LIST_TERMINATOR ) { break; } - NumOfLba = VA_ARG (Marker, UINT32); + NumOfLba = VA_ARG (Marker, UINTN); Status = EraseBlock (This, StartingLba, NumOfLba); if (EFI_ERROR (Status)) { break;