]> git.proxmox.com Git - mirror_edk2.git/commit
OvmfPkg/VirtioFsDxe: call IsTimeValid() before EfiTimeToEpoch()
authorLaszlo Ersek <lersek@redhat.com>
Thu, 7 Jan 2021 09:50:51 +0000 (10:50 +0100)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Thu, 7 Jan 2021 14:13:44 +0000 (14:13 +0000)
commite9c5ff3d2730433ff9ffadf6eb2ab1f47708bc18
tree051d8fea9b4442db20cf60522c73899182dd37e3
parentd8d1f6661d672c0a01bc46e67a29d8714db9dcb2
OvmfPkg/VirtioFsDxe: call IsTimeValid() before EfiTimeToEpoch()

EmbeddedPkg/TimeBaseLib provides a verification function called
IsTimeValid(), for enforcing the UEFI spec requirements on an EFI_TIME
object.

When EFI_FILE_PROTOCOL.SetInfo() is called in order to update the
timestamps on the file, let's invoke IsTimeValid() first, before passing
the new EFI_FILE_INFO.{CreateTime,LastAccessTime,ModificationTime} values
to EfiTimeToEpoch().

This patch is not expected to make a practical difference, but it's better
to ascertain the preconditions of EfiTimeToEpoch() on the
EFI_FILE_PROTOCOL.SetInfo() caller. The FAT driver (EnhancedFatDxe) has a
similar check, namely in FatSetFileInfo() -> FatIsValidTime().

Cc: Ard Biesheuvel <ard.biesheuvel@arm.com>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Message-Id: <20210107095051.22715-1-lersek@redhat.com>
Acked-by: Ard Biesheuvel <ard.biesheuvel@arm.com>
OvmfPkg/VirtioFsDxe/Helpers.c