diff options
author | Hao Wu <hao.a.wu@intel.com> | 2016-08-30 16:34:09 +0800 |
---|---|---|
committer | Hao Wu <hao.a.wu@intel.com> | 2016-09-06 15:31:41 +0800 |
commit | 80b405a64283b5adfd53b4f4fa48128c58422265 (patch) | |
tree | d4ec3c93d6e07d4833ad4e507c825ca7a1030e6f /MdeModulePkg/Bus | |
parent | b7f82a3a0fca88e8adf1820bd15326d3ebfb2109 (diff) | |
download | edk2-platforms-80b405a64283b5adfd53b4f4fa48128c58422265.tar.xz |
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>
Diffstat (limited to 'MdeModulePkg/Bus')
-rw-r--r-- | MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressPassthru.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressPassthru.c b/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressPassthru.c index 2209ee624b..96e9d88e52 100644 --- a/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressPassthru.c +++ b/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressPassthru.c @@ -423,6 +423,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.
//
if (Private->ControllerData->Mdts != 0) {
|