diff options
| author | Peter Jones <pjones@redhat.com> | 2021-03-11 11:30:14 -0500 |
|---|---|---|
| committer | Javier Martinez Canillas <javier@dowhile0.org> | 2021-03-12 10:15:01 +0100 |
| commit | ed6265c567f7e5aaa0d326e8a5fc21f3499f3ffc (patch) | |
| tree | 1f6a1a2471700dfb665da1e72661eaee95d90621 | |
| parent | df74fff124a84428c9717a89ff00ca0931d09c52 (diff) | |
| download | efi-boot-shim-ed6265c567f7e5aaa0d326e8a5fc21f3499f3ffc.tar.gz efi-boot-shim-ed6265c567f7e5aaa0d326e8a5fc21f3499f3ffc.zip | |
get_variable_attr(): fix a nit scan-build found.
scan-build believes we can hit a situation where get_variable_attr() is
called with NULL data, in which case we're not correctly returning an
error.
This adds the error return.
Signed-off-by: Peter Jones <pjones@redhat.com>
| -rw-r--r-- | lib/variables.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/variables.c b/lib/variables.c index 57875e26..9f5b2b57 100644 --- a/lib/variables.c +++ b/lib/variables.c @@ -224,6 +224,9 @@ get_variable_attr(const CHAR16 * const var, UINT8 **data, UINTN *len, { EFI_STATUS efi_status; + if (!len) + return EFI_INVALID_PARAMETER; + *len = 0; efi_status = gRT->GetVariable((CHAR16 *)var, &owner, NULL, len, NULL); @@ -233,6 +236,9 @@ get_variable_attr(const CHAR16 * const var, UINT8 **data, UINTN *len, return efi_status; } + if (!data) + return EFI_INVALID_PARAMETER; + /* * Add three zero pad bytes; at least one correctly aligned UCS-2 * character. |
