From 114358eaa856d4f48ecb0a9da68d9bb7659226c7 Mon Sep 17 00:00:00 2001 From: Hao Wu Date: Mon, 29 Aug 2016 09:01:26 +0800 Subject: [PATCH] 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 Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Hao Wu Reviewed-by: Feng Tian --- MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressPassthru.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressPassthru.c b/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressPassthru.c index f0d2f5a83b..ec7507e4c2 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. // -- 2.39.2