]> git.proxmox.com Git - mirror_edk2.git/commitdiff
ShellPkg: BcfgDisplayDump(): fix reporting of OptionalData
authorLaszlo Ersek <lersek@redhat.com>
Thu, 21 Jan 2016 18:40:30 +0000 (18:40 +0000)
committerlersek <lersek@Edk2>
Thu, 21 Jan 2016 18:40:30 +0000 (18:40 +0000)
In this cleaned up form of BcfgDisplayDump(), it is easier to see that the

  OptionalDataOffset <= BufferSize

expression, used to report whether optional data are *absent*, is
incorrect. For any well-formed EFI_LOAD_OPTION, this inequality always
holds.

Optional data are present exactly if

  OptionalDataOffset < BufferSize

therefore the absence condition is the negation of the above,

  OptionalDataOffset >= BufferSize

This patch fixes the bug where BCFG always reports "Optional- N", even if
optional data exist.

Cc: Jaben Carsey <jaben.carsey@intel.com>
Cc: Ryan Harkin <ryan.harkin@linaro.org>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@19715 6f19259b-4bc3-4df7-8a09-765794883524

ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCommandLib.c

index ca7ecd17519f85e155f7017c3f41ed004cf4f8d6..028f8523cd1d4db3e64628e16a86475c753b282e 100644 (file)
@@ -1133,7 +1133,7 @@ BcfgDisplayDump(
       VariableName,\r
       Description,\r
       DevPathString,\r
-      OptionalDataOffset <= BufferSize ? L'N' : L'Y'\r
+      OptionalDataOffset >= BufferSize ? L'N' : L'Y'\r
       );\r
     if (VerboseOutput) {\r
       for (LoopVar2 = OptionalDataOffset; LoopVar2 < BufferSize; LoopVar2++){\r