Date: Fri, 8 Feb 2019 14:56:28 +0000 (UTC) From: Marcin Wojtas <mw@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r343911 - head/stand/efi/libefi Message-ID: <201902081456.x18EuSMi036224@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: mw Date: Fri Feb 8 14:56:28 2019 New Revision: 343911 URL: https://svnweb.freebsd.org/changeset/base/343911 Log: 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. Extracted from a bigger patch as suggested by imp. Submitted by: Kornel Duleba <mindal@semihalf.com> Obtained from: Semihalf Sponsored by: Stormshield Modified: head/stand/efi/libefi/efienv.c Modified: head/stand/efi/libefi/efienv.c ============================================================================== --- head/stand/efi/libefi/efienv.c Fri Feb 8 14:32:27 2019 (r343910) +++ head/stand/efi/libefi/efienv.c Fri Feb 8 14:56:28 2019 (r343911) @@ -48,7 +48,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);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201902081456.x18EuSMi036224>