public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Jiewen Yao <jiewen.yao@intel.com>
To: edk2-devel@lists.01.org
Cc: Feng Tian <feng.tian@intel.com>, Star Zeng <star.zeng@intel.com>
Subject: [PATCH 2/2] MdeModulePkg/CapsuleApp: Dump capsule name in record.
Date: Thu, 22 Dec 2016 13:47:36 +0800	[thread overview]
Message-ID: <1482385656-1144-3-git-send-email-jiewen.yao@intel.com> (raw)
In-Reply-To: <1482385656-1144-1-git-send-email-jiewen.yao@intel.com>

According to UEFI spec, capsule report variable should include
a null terminator for capsule name and capsule target, if they are
not present.

Cc: Feng Tian <feng.tian@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jiewen Yao <jiewen.yao@intel.com>
---
 MdeModulePkg/Application/CapsuleApp/CapsuleDump.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/MdeModulePkg/Application/CapsuleApp/CapsuleDump.c b/MdeModulePkg/Application/CapsuleApp/CapsuleDump.c
index 8f44e5e..2bb5f1f 100644
--- a/MdeModulePkg/Application/CapsuleApp/CapsuleDump.c
+++ b/MdeModulePkg/Application/CapsuleApp/CapsuleDump.c
@@ -293,6 +293,8 @@ DmpCapsuleStatusVariable (
   UINTN                               CapsuleFileNameSize;
   CHAR16                              CapsuleIndexData[12];
   CHAR16                              *CapsuleIndex;
+  CHAR16                              *CapsuleFileName;
+  CHAR16                              *CapsuleTarget;
 
   Status = GetVariable2(
              L"CapsuleMax",
@@ -353,19 +355,17 @@ DmpCapsuleStatusVariable (
     }
 
     if (CompareGuid(&CapsuleResult->CapsuleGuid, &gEfiFmpCapsuleGuid)) {
-      if (CapsuleResult->VariableTotalSize >= sizeof(EFI_CAPSULE_RESULT_VARIABLE_HEADER) + sizeof(EFI_CAPSULE_RESULT_VARIABLE_FMP)) {
+      if (CapsuleResult->VariableTotalSize >= sizeof(EFI_CAPSULE_RESULT_VARIABLE_HEADER) + sizeof(EFI_CAPSULE_RESULT_VARIABLE_FMP) + sizeof(CHAR16) * 2) {
         CapsuleResultFmp = (EFI_CAPSULE_RESULT_VARIABLE_FMP *)(CapsuleResult + 1);
         Print(L"  Capsule FMP Version: 0x%x\n", CapsuleResultFmp->Version);
         Print(L"  Capsule FMP PayloadIndex: 0x%x\n", CapsuleResultFmp->PayloadIndex);
         Print(L"  Capsule FMP UpdateImageIndex: 0x%x\n", CapsuleResultFmp->UpdateImageIndex);
         Print(L"  Capsule FMP UpdateImageTypeId: %g\n", &CapsuleResultFmp->UpdateImageTypeId);
-        if (CapsuleResult->VariableTotalSize > sizeof(EFI_CAPSULE_RESULT_VARIABLE_HEADER) + sizeof(EFI_CAPSULE_RESULT_VARIABLE_FMP)) {
-          Print(L"  Capsule FMP CapsuleFileName: %s\n", (CapsuleResultFmp + 1));
-          CapsuleFileNameSize = StrSize((CHAR16 *)(CapsuleResultFmp + 1));
-          if (CapsuleResult->VariableTotalSize > sizeof(EFI_CAPSULE_RESULT_VARIABLE_HEADER) + sizeof(EFI_CAPSULE_RESULT_VARIABLE_FMP) + CapsuleFileNameSize) {
-            Print(L"  Capsule FMP CapsuleTarget: %s\n", (UINT8 *)(CapsuleResultFmp + 1) + CapsuleFileNameSize);
-          }
-        }
+        CapsuleFileName = (CHAR16 *)(CapsuleResultFmp + 1);
+        Print(L"  Capsule FMP CapsuleFileName: \"%s\"\n", CapsuleFileName);
+        CapsuleFileNameSize = StrSize(CapsuleFileName);
+        CapsuleTarget = (CHAR16 *)((UINTN)CapsuleFileName + CapsuleFileNameSize);
+        Print(L"  Capsule FMP CapsuleTarget: \"%s\"\n", CapsuleTarget);
       }
     }
 
-- 
2.7.4.windows.1



  parent reply	other threads:[~2016-12-22  5:48 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-22  5:47 [PATCH 0/2] Handle NULL capsule name in record Jiewen Yao
2016-12-22  5:47 ` [PATCH 1/2] MdeModulePkg/CapsuleLib: Add " Jiewen Yao
2016-12-22  5:47 ` Jiewen Yao [this message]
2016-12-23  1:14 ` [PATCH 0/2] Handle " Tian, Feng
2016-12-23  2:00 ` 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=1482385656-1144-3-git-send-email-jiewen.yao@intel.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