Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 26 Apr 2019 00:39:31 +0000 (UTC)
From:      Marcin Wojtas <mw@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org
Subject:   svn commit: r346718 - stable/12/stand/efi/libefi
Message-ID:  <201904260039.x3Q0dVMw080819@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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@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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201904260039.x3Q0dVMw080819>