From patchwork Fri May 8 05:51:21 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 245302 List-Id: U-Boot discussion From: takahiro.akashi at linaro.org (AKASHI Takahiro) Date: Fri, 8 May 2020 14:51:21 +0900 Subject: [PATCH] efi_loader: variable: check a return value of uuid__str_to_bin() Message-ID: <20200508055121.7559-1-takahiro.akashi@linaro.org> The only error case is that a given UUID is in wrong format. So just return EFI_INVALID_PARAMETER here. Signed-off-by: AKASHI Takahiro Reported-by: Coverity (CID 300333) --- lib/efi_loader/efi_variable.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/efi_loader/efi_variable.c b/lib/efi_loader/efi_variable.c index f40b194b13bf..38d21b9314f2 100644 --- a/lib/efi_loader/efi_variable.c +++ b/lib/efi_loader/efi_variable.c @@ -866,7 +866,10 @@ static efi_status_t parse_uboot_variable(char *variable, /* guid */ c = *(name - 1); *(name - 1) = '\0'; /* guid need be null-terminated here */ - uuid_str_to_bin(guid, (unsigned char *)vendor, UUID_STR_FORMAT_GUID); + if (uuid_str_to_bin(guid, (unsigned char *)vendor, + UUID_STR_FORMAT_GUID)) + /* The only error would be EINVAL. */ + return EFI_INVALID_PARAMETER; *(name - 1) = c; /* attributes */