Blob Blame History Raw
From 6df96cdb20b84b33027d2e40bc0dbe0676d31282 Mon Sep 17 00:00:00 2001
From: Peter Jones <pjones@redhat.com>
Date: Thu, 23 Jul 2020 19:01:27 -0400
Subject: [PATCH 53/62] MokManager: fix a wrong allocation failure check.

Signed-off-by: Peter Jones <pjones@redhat.com>
Upstream: pr#212
---
 MokManager.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/MokManager.c b/MokManager.c
index 654a115033c..c9949e33bcf 100644
--- a/MokManager.c
+++ b/MokManager.c
@@ -1085,9 +1085,11 @@ static EFI_STATUS write_back_mok_list(MokListNode * list, INTN key_num,
 			DataSize += sizeof(EFI_GUID);
 		DataSize += list[i].MokSize;
 	}
+	if (DataSize == 0)
+		return EFI_SUCCESS;
 
 	Data = AllocatePool(DataSize);
-	if (Data == NULL && DataSize != 0)
+	if (Data == NULL)
 		return EFI_OUT_OF_RESOURCES;
 
 	ptr = Data;
-- 
2.26.2