From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.43; helo=mga05.intel.com; envelope-from=michael.d.kinney@intel.com; receiver=edk2-devel@lists.01.org Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 15CEB21DF809D for ; Tue, 31 Jul 2018 23:57:52 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 31 Jul 2018 23:57:51 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,431,1526367600"; d="scan'208";a="61121297" Received: from mdkinney-mobl2.amr.corp.intel.com ([10.254.71.234]) by orsmga007.jf.intel.com with ESMTP; 31 Jul 2018 23:57:44 -0700 From: "Kinney, Michael D" To: edk2-devel@lists.01.org Cc: Star Zeng , Michael D Kinney Date: Tue, 31 Jul 2018 23:55:13 -0700 Message-Id: <20180801065722.9500-14-michael.d.kinney@intel.com> X-Mailer: git-send-email 2.14.2.windows.3 In-Reply-To: <20180801065722.9500-1-michael.d.kinney@intel.com> References: <20180801065722.9500-1-michael.d.kinney@intel.com> Subject: [Patch v5 13/21] FmpDevicePkg FmpDxe: Add NULL check to return Value from GetVariable2 X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Aug 2018 06:57:53 -0000 From: Star Zeng Cc: Michael D Kinney Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Star Zeng Reviewed-by: Michael D Kinney --- FmpDevicePkg/FmpDxe/VariableSupport.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/FmpDevicePkg/FmpDxe/VariableSupport.c b/FmpDevicePkg/FmpDxe/VariableSupport.c index c15178d099..6a4330ad6a 100644 --- a/FmpDevicePkg/FmpDxe/VariableSupport.c +++ b/FmpDevicePkg/FmpDxe/VariableSupport.c @@ -72,7 +72,7 @@ GetVersionFromVariable ( Version = DEFAULT_VERSION; Status = GetVariable2 (VARNAME_VERSION, &gEfiCallerIdGuid, (VOID **)&Value, &Size); - if (EFI_ERROR (Status)) { + if (EFI_ERROR (Status) || (Value == NULL)) { DEBUG ((DEBUG_ERROR, "Failed to get the Version from variable. Status = %r\n", Status)); return Version; } @@ -125,7 +125,7 @@ GetLowestSupportedVersionFromVariable ( Version = DEFAULT_LOWESTSUPPORTEDVERSION; Status = GetVariable2 (VARNAME_LSV, &gEfiCallerIdGuid, (VOID **)&Value, &Size); - if (EFI_ERROR (Status)) { + if (EFI_ERROR (Status) || (Value == NULL)) { DEBUG ((DEBUG_WARN, "Warning: Failed to get the Lowest Supported Version from variable. Status = %r\n", Status)); return Version; } @@ -177,7 +177,7 @@ GetLastAttemptStatusFromVariable ( LastAttemptStatus = DEFAULT_LASTATTEMPT; Status = GetVariable2 (VARNAME_LASTATTEMPTSTATUS, &gEfiCallerIdGuid, (VOID **)&Value, &Size); - if (EFI_ERROR (Status)) { + if (EFI_ERROR (Status) || (Value == NULL)) { DEBUG ((DEBUG_WARN, "Warning: Failed to get the Last Attempt Status from variable. Status = %r\n", Status)); return LastAttemptStatus; } @@ -233,7 +233,7 @@ GetLastAttemptVersionFromVariable ( Version = DEFAULT_LASTATTEMPT; Status = GetVariable2 (VARNAME_LASTATTEMPTVERSION, &gEfiCallerIdGuid, (VOID **)&Value, &Size); - if (EFI_ERROR (Status)) { + if (EFI_ERROR (Status) || (Value == NULL)) { DEBUG ((DEBUG_WARN, "Warning: Failed to get the Last Attempt Version from variable. Status = %r\n", Status)); return Version; } -- 2.14.2.windows.3