mirror of https://github.com/acidanthera/audk.git
ArmPlatformPkg/NorFlashDxe: 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. In addition, update the DEBUG macro invocation where NumOfLba is formatted with the %d conversion specifier: UINTN values should be converted to UINT64 and printed with %Lu or %Lx for portability between 32-bit and 64-bit. Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org> Cc: Jordan Justen <jordan.l.justen@intel.com> Cc: Leif Lindholm <leif.lindholm@linaro.org> Reported-by: Jordan Justen <jordan.l.justen@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
This commit is contained in:
parent
7a85e84741
commit
ce69cc776c
|
@ -628,10 +628,16 @@ FvbEraseBlocks (
|
||||||
}
|
}
|
||||||
|
|
||||||
// How many Lba blocks are we requested to erase?
|
// How many Lba blocks are we requested to erase?
|
||||||
NumOfLba = VA_ARG (Args, UINT32);
|
NumOfLba = VA_ARG (Args, UINTN);
|
||||||
|
|
||||||
// All blocks must be within range
|
// All blocks must be within range
|
||||||
DEBUG ((DEBUG_BLKIO, "FvbEraseBlocks: Check if: ( StartingLba=%ld + NumOfLba=%d - 1 ) > LastBlock=%ld.\n", Instance->StartLba + StartingLba, NumOfLba, Instance->Media.LastBlock));
|
DEBUG ((
|
||||||
|
DEBUG_BLKIO,
|
||||||
|
"FvbEraseBlocks: Check if: ( StartingLba=%ld + NumOfLba=%Lu - 1 ) > LastBlock=%ld.\n",
|
||||||
|
Instance->StartLba + StartingLba,
|
||||||
|
(UINT64)NumOfLba,
|
||||||
|
Instance->Media.LastBlock
|
||||||
|
));
|
||||||
if ((NumOfLba == 0) || ((Instance->StartLba + StartingLba + NumOfLba - 1) > Instance->Media.LastBlock)) {
|
if ((NumOfLba == 0) || ((Instance->StartLba + StartingLba + NumOfLba - 1) > Instance->Media.LastBlock)) {
|
||||||
VA_END (Args);
|
VA_END (Args);
|
||||||
DEBUG ((EFI_D_ERROR, "FvbEraseBlocks: ERROR - Lba range goes past the last Lba.\n"));
|
DEBUG ((EFI_D_ERROR, "FvbEraseBlocks: ERROR - Lba range goes past the last Lba.\n"));
|
||||||
|
@ -656,7 +662,7 @@ FvbEraseBlocks (
|
||||||
}
|
}
|
||||||
|
|
||||||
// How many Lba blocks are we requested to erase?
|
// How many Lba blocks are we requested to erase?
|
||||||
NumOfLba = VA_ARG (Args, UINT32);
|
NumOfLba = VA_ARG (Args, UINTN);
|
||||||
|
|
||||||
// Go through each one and erase it
|
// Go through each one and erase it
|
||||||
while (NumOfLba > 0) {
|
while (NumOfLba > 0) {
|
||||||
|
|
Loading…
Reference in New Issue