MdeModulePkg NvmExpressDxe: Add NamespaceId validity check in PassThru

According to the UEFI spec, EFI_NVM_EXPRESS_PASS_THRU_PROTOCOL.PassThru()
should return EFI_INVALID_PARAMETER if the input 'NamespaceId' is invalid
for the NVM Express controller. This commit adds check in PassThru() 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-30 16:34:09 +08:00
parent b7f82a3a0f
commit 80b405a642
1 changed files with 8 additions and 0 deletions

View File

@ -422,6 +422,14 @@ NvmExpressPassThru (
Private = NVME_CONTROLLER_PRIVATE_DATA_FROM_PASS_THRU (This);
//
// Check NamespaceId is valid or not.
//
if ((NamespaceId > Private->ControllerData->Nn) &&
(NamespaceId != (UINT32) -1)) {
return EFI_INVALID_PARAMETER;
}
//
// Check whether TransferLength exceeds the maximum data transfer size.
//