From ed6265c567f7e5aaa0d326e8a5fc21f3499f3ffc Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Thu, 11 Mar 2021 11:30:14 -0500 Subject: 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 --- lib/variables.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'lib/variables.c') 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. -- cgit v1.2.3