summaryrefslogtreecommitdiff
path: root/MdeModulePkg
diff options
context:
space:
mode:
authorHao Wu <hao.a.wu@intel.com>2016-08-29 09:01:26 +0800
committerHao Wu <hao.a.wu@intel.com>2016-09-06 15:31:26 +0800
commit114358eaa856d4f48ecb0a9da68d9bb7659226c7 (patch)
tree0a760f041efd5701b4bd294e3ee7c6d9095dbfb0 /MdeModulePkg
parent284dc9bfe40dfb113986ed49d6419435d42f22b3 (diff)
downloadedk2-114358eaa856d4f48ecb0a9da68d9bb7659226c7.zip
edk2-114358eaa856d4f48ecb0a9da68d9bb7659226c7.tar.gz
edk2-114358eaa856d4f48ecb0a9da68d9bb7659226c7.tar.bz2
MdeModulePkg NvmExpressDxe: Refine GetNextNamespace API to follow spec
According to the UEFI spec, EFI_NVM_EXPRESS_PASS_THRU_PROTOCOL.GetNextNamespace() should return EFI_NOT_FOUND when the value pointed to by NamespaceId is the namespace ID of the last namespace on the NVM Express controller. This commit modifies the check for NamespaceId to follow this rule. Cc: Feng Tian <feng.tian@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Hao Wu <hao.a.wu@intel.com> Reviewed-by: Feng Tian <feng.tian@intel.com>
Diffstat (limited to 'MdeModulePkg')
-rw-r--r--MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressPassthru.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressPassthru.c b/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressPassthru.c
index f0d2f5a..ec7507e 100644
--- a/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressPassthru.c
+++ b/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressPassthru.c
@@ -758,11 +758,15 @@ NvmExpressGetNextNamespace (
*NamespaceId = NextNamespaceId;
} else {
- if (*NamespaceId >= Private->ControllerData->Nn) {
+ if (*NamespaceId > Private->ControllerData->Nn) {
return EFI_INVALID_PARAMETER;
}
NextNamespaceId = *NamespaceId + 1;
+ if (NextNamespaceId > Private->ControllerData->Nn) {
+ return EFI_NOT_FOUND;
+ }
+
//
// Allocate buffer for Identify Namespace data.
//