audk/ShellPkg/Library
Laszlo Ersek 7eb3bb6c55 ShellPkg/UefiHandleParsingLib: fix retval for empty child controller array
The ParseHandleDatabaseForChildControllers() function intends to work like
this:

(1) It allocates a "HandleBufferForReturn" local array that's guaranteed
    to be big enough for all found handles,

(2) it collects the handles, both counting them in the (mandatory)
    "MatchingHandleCount" output parameter, and saving them in the local
    "HandleBufferForReturn" array,

(3) if the caller is not interested in the actual handles, then
    "HandleBufferForReturn" is released,

(4) if the caller is interested in the handles, and we've found some, then
    "HandleBufferForReturn" is passed out through the
    "MatchingHandleBuffer" output parameter,

(5) if the caller is interested in the actual handles, but we've found
    none, then the "MatchingHandleBuffer" output parameter is set to NULL.

The ASSERT() at the end of the function makes this clear, but the
implementation does not conform to (5). Fix it.

Cc: Jaben Carsey <jaben.carsey@intel.com>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Tapan Shah <tapandshah@hpe.com>
Reported-by: Tapan Shah <tapandshah@hpe.com>
Ref: https://tianocore.acgmultimedia.com/show_bug.cgi?id=112
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
Reviewed-by: Tapan Shah <tapandshah@hpe.com>
2016-09-08 20:43:37 +02:00
..
UefiDpLib ShellPkg/Dp: Handle memory allocation failure 2016-07-18 10:55:08 +08:00
UefiHandleParsingLib ShellPkg/UefiHandleParsingLib: fix retval for empty child controller array 2016-09-08 20:43:37 +02:00
UefiShellBcfgCommandLib ShellPkg: Add check for "dump" parameter in "bcfg" command 2016-09-01 16:38:06 +08:00
UefiShellCEntryLib ShellPkg: Refine the fomat in INF/DEC files to follow spec. 2015-01-22 01:44:11 +00:00
UefiShellCommandLib Revert "ShellPkg: Move FindFirstCharacter/GetNextParameter to ShellCommandLib" 2016-08-25 13:00:47 +08:00
UefiShellDebug1CommandsLib ShellPkg: pci -i -_e to print next capability 2016-09-08 09:27:40 -07:00
UefiShellDriver1CommandsLib ShellPkg: Add the check of parameter number in "DrvCfg" command 2016-09-01 16:38:06 +08:00
UefiShellInstall1CommandsLib Revert "ShellPkg : Add UEFI_APPLICATION module type to UefiShellInstall1CommandsLib.inf" 2016-01-06 16:23:20 +00:00
UefiShellLevel1CommandsLib ShellPkg/If: Fix issue to pass static code checker 2016-07-25 10:20:13 +08:00
UefiShellLevel2CommandsLib ShellPkg/Ls: Handle the case when SearchString is NULL 2016-08-17 13:44:51 +08:00
UefiShellLevel3CommandsLib Revert "ShellPkg: Fix echo to support displaying special characters" 2016-08-25 13:00:42 +08:00
UefiShellLib ShellPkg/UefiShellLib.c: Handle memory allocation failure 2016-07-18 11:04:16 +08:00
UefiShellNetwork1CommandsLib ShellPkg/IfConfig: Handle memory allocation failure 2016-07-18 11:04:13 +08:00
UefiShellNetwork2CommandsLib ShellPkg/Ping6: Handle memory allocation failure 2016-07-18 11:04:22 +08:00
UefiShellTftpCommandLib ShellPkg-UefiShellTftpCommandLib: Replace compiler builtin 2016-08-10 12:56:37 +08:00