public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: cinnamon shia <cinnamon.shia@hpe.com>
To: edk2-devel@lists.01.org
Cc: lersek@redhat.com, star.zeng@intel.com,
	cinnamon shia <cinnamon.shia@hpe.com>,
	Ansen Huang <ansen.huang@hpe.com>
Subject: [PATCH 2/2] MdeModulePkg Variable: Correct the returned EFI_STATUS in the UpdateVariableStore().
Date: Fri, 11 May 2018 12:17:53 +0800	[thread overview]
Message-ID: <20180511041753.32040-2-cinnamon.shia@hpe.com> (raw)
In-Reply-To: <20180511041753.32040-1-cinnamon.shia@hpe.com>

If Fvb is a NULL, EFI_NOT_FOUND should be returned.
If the remaining size is not enough, EFI_OUT_OF_RESOURCES should be returned.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: cinnamon shia <cinnamon.shia@hpe.com>
Signed-off-by: Ansen Huang <ansen.huang@hpe.com>
---
 MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c b/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c
index 7303681aaa..fc10cd9e18 100644
--- a/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c
+++ b/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c
@@ -238,6 +238,8 @@ IsValidVariableHeader (
   @param Buffer                  Pointer to the buffer from which data is written.
 
   @retval EFI_INVALID_PARAMETER  Parameters not valid.
+  @retval EFI_NOT_FOUND          Fvb is a NULL.
+  @retval EFI_OUT_OF_RESOURCES   The remaining size is not enough.
   @retval EFI_SUCCESS            Variable store successfully updated.
 
 **/
@@ -274,7 +276,7 @@ UpdateVariableStore (
   //
   if (!Volatile) {
     if (Fvb == NULL) {
-      return EFI_INVALID_PARAMETER;
+      return EFI_NOT_FOUND;
     }
     Status = Fvb->GetPhysicalAddress(Fvb, &FvVolHdr);
     ASSERT_EFI_ERROR (Status);
@@ -289,7 +291,7 @@ UpdateVariableStore (
     }
 
     if ((DataPtr + DataSize) > ((EFI_PHYSICAL_ADDRESS) (UINTN) ((UINT8 *) FwVolHeader + FwVolHeader->FvLength))) {
-      return EFI_INVALID_PARAMETER;
+      return EFI_OUT_OF_RESOURCES;
     }
   } else {
     //
@@ -302,7 +304,7 @@ UpdateVariableStore (
     }
 
     if ((DataPtr + DataSize) > ((UINTN) ((UINT8 *) VolatileBase + VolatileBase->Size))) {
-      return EFI_INVALID_PARAMETER;
+      return EFI_OUT_OF_RESOURCES;
     }
 
     //
-- 
2.16.1.windows.4



  reply	other threads:[~2018-05-11  4:18 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-11  4:17 [PATCH 1/2] MdeModulePkg Variable: Failed to set a variable if the remaining size is equal to the variable data size cinnamon shia
2018-05-11  4:17 ` cinnamon shia [this message]
2018-05-11  8:37   ` [PATCH 2/2] MdeModulePkg Variable: Correct the returned EFI_STATUS in the UpdateVariableStore() Zeng, Star
2018-05-11  8:43     ` Shia, Cinnamon
2018-05-11  8:47       ` Zeng, Star
2018-05-11  8:49         ` Shia, Cinnamon
2018-05-11  8:26 ` [PATCH 1/2] MdeModulePkg Variable: Failed to set a variable if the remaining size is equal to the variable data size Zeng, Star

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180511041753.32040-2-cinnamon.shia@hpe.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox