]> git.proxmox.com Git - mirror_edk2.git/commitdiff
MdeModulePkg NvmExpressDxe: Refine GetNextNamespace API to follow spec
authorHao Wu <hao.a.wu@intel.com>
Mon, 29 Aug 2016 01:01:26 +0000 (09:01 +0800)
committerHao Wu <hao.a.wu@intel.com>
Tue, 6 Sep 2016 07:31:26 +0000 (15:31 +0800)
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>
MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressPassthru.c

index f0d2f5a83bd37fb20e70c09e17c8e7d0ad0e204e..ec7507e4c29a100cfc109f461fa8aae2b471bd54 100644 (file)
@@ -758,11 +758,15 @@ NvmExpressGetNextNamespace (
 \r
     *NamespaceId = NextNamespaceId;\r
   } else {\r
-    if (*NamespaceId >= Private->ControllerData->Nn) {\r
+    if (*NamespaceId > Private->ControllerData->Nn) {\r
       return EFI_INVALID_PARAMETER;\r
     }\r
 \r
     NextNamespaceId = *NamespaceId + 1;\r
+    if (NextNamespaceId > Private->ControllerData->Nn) {\r
+      return EFI_NOT_FOUND;\r
+    }\r
+\r
     //\r
     // Allocate buffer for Identify Namespace data.\r
     //\r