svn commit: r346718 - stable/12/stand/efi/libefi
Marcin Wojtas
mw at FreeBSD.org
Fri Apr 26 00:39:32 UTC 2019
Author: mw
Date: Fri Apr 26 00:39:30 2019
New Revision: 346718
URL: https://svnweb.freebsd.org/changeset/base/346718
Log:
MFC r343911: Allow reading the UEFI variable size
When loading bigger variables form UEFI it is necessary to know their
size beforehand, so that an appropriate amount of memory can be
allocated. The easiest way to do this is to try to read the variable
with buffer size equal 0, expecting EFI_BUFFER_TOO_SMALL error to be
returned. Allow such possible approach in efi_getenv routine.
Submitted by: Kornel Duleba <mindal at semihalf.com>
Obtained from: Semihalf
Sponsored by: Stormshield
Modified:
stable/12/stand/efi/libefi/efienv.c
Modified: stable/12/stand/efi/libefi/efienv.c
==============================================================================
--- stable/12/stand/efi/libefi/efienv.c Thu Apr 25 22:53:55 2019 (r346717)
+++ stable/12/stand/efi/libefi/efienv.c Fri Apr 26 00:39:30 2019 (r346718)
@@ -49,7 +49,7 @@ efi_getenv(EFI_GUID *g, const char *v, void *data, siz
return (EFI_OUT_OF_RESOURCES);
dl = *len;
rv = RS->GetVariable(uv, g, &attr, &dl, data);
- if (rv == EFI_SUCCESS)
+ if (rv == EFI_SUCCESS || rv == EFI_BUFFER_TOO_SMALL)
*len = dl;
free(uv);
return (rv);
More information about the svn-src-all
mailing list