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>
This commit is contained in:
Hao Wu 2016-08-29 09:01:26 +08:00
parent 284dc9bfe4
commit 114358eaa8
1 changed files with 5 additions and 1 deletions

View File

@ -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.
//