Check the return value from utf8_to_ucs2 instead of whether or not uv

is NULL. That's more correct and doesn't depend on the error behavior
of utf8_to_ucs2. In practice, we'll never see this though since we
pass utf8_to_ucs2 a well formed string.

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D13918
This commit is contained in:
Warner Losh 2018-01-15 22:17:34 +00:00
parent 27d95c1a03
commit 96c4f2c537
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=328030

View File

@ -106,8 +106,7 @@ efi_setenv_freebsd_wcs(const char *varname, CHAR16 *valstr)
size_t len;
EFI_STATUS rv;
utf8_to_ucs2(varname, &var, &len);
if (var == NULL)
if (utf8_to_ucs2(varname, &var, &len) != 0)
return (EFI_OUT_OF_RESOURCES);
rv = RS->SetVariable(var, &FreeBSDBootVarGUID,
EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,