diff options
author | Toomas Soome <tsoome@me.com> | 2018-07-09 14:05:56 +0300 |
---|---|---|
committer | Dan McDonald <danmcd@joyent.com> | 2018-12-03 09:31:37 -0500 |
commit | 2b811402e28c1eea57dd7a5e98c7f1c72637ffd9 (patch) | |
tree | b514739f174b8db5a366a13831132154c077d13a /usr | |
parent | f111a354011b4b6a93d3b8d94aa06a982d8c7686 (diff) | |
download | illumos-gate-2b811402e28c1eea57dd7a5e98c7f1c72637ffd9.tar.gz |
9975 loader.efi: unused variable 'err'
Reviewed by: Igor Kozhukhov <igor@dilos.org>
Reviewed by: Robert Mustacchi <rm@joyent.com>
Reviewed by: Gergő Mihály Doma <domag02@gmail.com>
Reviewed by: John Levon <john.levon@joyent.com>
Approved by: Dan McDonald <danmcd@joyent.com>
Diffstat (limited to 'usr')
-rw-r--r-- | usr/src/boot/sys/boot/efi/libefi/env.c | 30 |
1 files changed, 26 insertions, 4 deletions
diff --git a/usr/src/boot/sys/boot/efi/libefi/env.c b/usr/src/boot/sys/boot/efi/libefi/env.c index a1f1e812d2..231e90d5a1 100644 --- a/usr/src/boot/sys/boot/efi/libefi/env.c +++ b/usr/src/boot/sys/boot/efi/libefi/env.c @@ -42,6 +42,24 @@ #include "bootstrap.h" #include "ficl.h" +/* + * About ENABLE_UPDATES + * + * The UEFI variables are identified only by GUID and name, there is no + * way to (auto)detect the type for the value, so we need to process the + * variables case by case, as we do learn about them. + * + * While showing the variable name and the value is safe, we must not store + * random values nor allow removing (random) variables. + * + * Since we do have stub code to set/unset the variables, I do want to keep + * it to make the future development a bit easier, but the updates are disabled + * by default till: + * a) the validation and data translation to values is properly implemented + * b) We have established which variables we do allow to be updated. + * Therefore the set/unset code is included only for developers aid. + */ + static struct efi_uuid_mapping { const char *efi_guid_name; EFI_GUID efi_guid; @@ -763,7 +781,7 @@ command_efi_show(int argc, char *argv[]) case 'v': vflag = 1; if (strlen(optarg) >= nitems(varnamearg)) { - printf("Variable %s is longer than %zd " + printf("Variable %s is longer than %zu " "characters\n", optarg, nitems(varnamearg)); return (CMD_ERROR); } @@ -802,7 +820,7 @@ command_efi_show(int argc, char *argv[]) if (argc == 2) { optarg = argv[0]; if (strlen(optarg) >= nitems(varnamearg)) { - printf("Variable %s is longer than %zd characters\n", + printf("Variable %s is longer than %zu characters\n", optarg, nitems(varnamearg)); pager_close(); return (CMD_ERROR); @@ -914,7 +932,9 @@ command_efi_set(int argc, char *argv[]) char *uuid, *var, *val; CHAR16 wvar[128]; EFI_GUID guid; +#if defined(ENABLE_UPDATES) EFI_STATUS err; +#endif if (argc != 4) { printf("efi-set uuid var new-value\n"); @@ -928,7 +948,7 @@ command_efi_set(int argc, char *argv[]) return (CMD_ERROR); } cpy8to16(var, wvar, nitems(wvar)); -#if 0 +#if defined(ENABLE_UPDATES) err = RS->SetVariable(wvar, &guid, EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_BOOTSERVICE_ACCESS, strlen(val) + 1, val); @@ -951,7 +971,9 @@ command_efi_unset(int argc, char *argv[]) char *uuid, *var; CHAR16 wvar[128]; EFI_GUID guid; +#if defined(ENABLE_UPDATES) EFI_STATUS err; +#endif if (argc != 3) { printf("efi-unset uuid var\n"); @@ -964,7 +986,7 @@ command_efi_unset(int argc, char *argv[]) return (CMD_ERROR); } cpy8to16(var, wvar, nitems(wvar)); -#if 0 +#if defined(ENABLE_UPDATES) err = RS->SetVariable(wvar, &guid, 0, 0, NULL); if (EFI_ERROR(err)) { printf("Failed to unset variable: error %lu\n", |