summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaszlo Ersek <lersek@redhat.com>2016-01-21 18:40:13 +0000
committerHao Wu <hao.a.wu@intel.com>2016-07-13 20:41:31 +0800
commit8d3baa7fde0b24ce40d24eabbb6dc71696e1d20f (patch)
treec7350af20ee2cdf196d4e8cb862108ffb65bd11f
parentd8f9fd6c8bb5f3006b215d1c59669cc7a6ddb04a (diff)
downloadedk2-platforms-8d3baa7fde0b24ce40d24eabbb6dc71696e1d20f.tar.xz
ShellPkg: BcfgDisplayDump(): address FilePathListLength by name
The Buffer variable points at the beginning of an EFI_LOAD_OPTION structure. We might as well address the "FilePathListLength" member by name, rather than with *(UINT16*)(Buffer+4). This patch is not supposed to change behavior. 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@19711 6f19259b-4bc3-4df7-8a09-765794883524 (cherry picked from commit 3b6b1105cf31a3547d6157e912d72ec9ddc69a4b)
-rw-r--r--ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCommandLib.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCommandLib.c b/ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCommandLib.c
index 9955c9e640..b08aac1bd8 100644
--- a/ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCommandLib.c
+++ b/ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCommandLib.c
@@ -1108,11 +1108,12 @@ BcfgDisplayDump(
++Errors;
goto Cleanup;
}
+ LoadOption = (EFI_LOAD_OPTION *)Buffer;
- if ((*(UINT16*)(Buffer+4)) != 0) {
- DevPath = AllocateZeroPool(*(UINT16*)(Buffer+4));
+ if (LoadOption->FilePathListLength != 0) {
+ DevPath = AllocateZeroPool(LoadOption->FilePathListLength);
if (DevPath != NULL) {
- CopyMem(DevPath, Buffer+6+StrSize((CHAR16*)(Buffer+6)), *(UINT16*)(Buffer+4));
+ CopyMem(DevPath, Buffer+6+StrSize((CHAR16*)(Buffer+6)), LoadOption->FilePathListLength);
DevPathString = ConvertDevicePathToText(DevPath, TRUE, FALSE);
}
}
@@ -1126,9 +1127,9 @@ BcfgDisplayDump(
VariableName,
(CHAR16*)(Buffer+6),
DevPathString,
- (StrSize((CHAR16*)(Buffer+6)) + *(UINT16*)(Buffer+4) + 6) <= BufferSize?L'N':L'Y');
+ (StrSize((CHAR16*)(Buffer+6)) + LoadOption->FilePathListLength + 6) <= BufferSize?L'N':L'Y');
if (VerboseOutput) {
- for (LoopVar2 = (StrSize((CHAR16*)(Buffer+6)) + *(UINT16*)(Buffer+4) + 6);LoopVar2<BufferSize;LoopVar2++){
+ for (LoopVar2 = (StrSize((CHAR16*)(Buffer+6)) + LoadOption->FilePathListLength + 6);LoopVar2<BufferSize;LoopVar2++){
ShellPrintEx(
-1,
-1,