public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH] MdeModulePkg NvmExpressDxe: return error code in error path
@ 2018-04-23  8:17 Star Zeng
  2018-04-23 11:25 ` Wu, Hao A
  0 siblings, 1 reply; 2+ messages in thread
From: Star Zeng @ 2018-04-23  8:17 UTC (permalink / raw)
  To: edk2-devel; +Cc: Star Zeng, Hao Wu, Ruiyu Ni, Michael Turner

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=937

In NvmeExpressPassthru.c near line 659:
    Prp = NvmeCreatePrpList (
            PciIo,
            PhyAddr,
            EFI_SIZE_TO_PAGES(Offset + Bytes) - 1,
            &PrpListHost,
            &PrpListNo,
            &MapPrpList
            );
    if (Prp == NULL) {
      goto EXIT;
    }
Status is not set to an error code - Status is initialized to
EFI_SUCCESS, or set by a PciIo->Map to EFI_SUCCESS above this
code. This error path should set Status to an error code before
goto EXIT.

Cc: Hao Wu <hao.a.wu@intel.com>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Michael Turner <Michael.Turner@microsoft.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Star Zeng <star.zeng@intel.com>
---
 MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressPassthru.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressPassthru.c b/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressPassthru.c
index 302cfdcd8d8d..cfad1587f299 100644
--- a/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressPassthru.c
+++ b/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressPassthru.c
@@ -656,6 +656,7 @@ NvmExpressPassThru (
     PhyAddr = (Sq->Prp[0] + EFI_PAGE_SIZE) & ~(EFI_PAGE_SIZE - 1);
     Prp = NvmeCreatePrpList (PciIo, PhyAddr, EFI_SIZE_TO_PAGES(Offset + Bytes) - 1, &PrpListHost, &PrpListNo, &MapPrpList);
     if (Prp == NULL) {
+      Status = EFI_OUT_OF_RESOURCES;
       goto EXIT;
     }
 
-- 
2.7.0.windows.1



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] MdeModulePkg NvmExpressDxe: return error code in error path
  2018-04-23  8:17 [PATCH] MdeModulePkg NvmExpressDxe: return error code in error path Star Zeng
@ 2018-04-23 11:25 ` Wu, Hao A
  0 siblings, 0 replies; 2+ messages in thread
From: Wu, Hao A @ 2018-04-23 11:25 UTC (permalink / raw)
  To: Zeng, Star, edk2-devel@lists.01.org; +Cc: Ni, Ruiyu, Michael Turner

Reviewed-by: Hao Wu <hao.a.wu@intel.com>


Best Regards,
Hao Wu


> -----Original Message-----
> From: Zeng, Star
> Sent: Monday, April 23, 2018 4:18 PM
> To: edk2-devel@lists.01.org
> Cc: Zeng, Star; Wu, Hao A; Ni, Ruiyu; Michael Turner
> Subject: [PATCH] MdeModulePkg NvmExpressDxe: return error code in error
> path
> 
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=937
> 
> In NvmeExpressPassthru.c near line 659:
>     Prp = NvmeCreatePrpList (
>             PciIo,
>             PhyAddr,
>             EFI_SIZE_TO_PAGES(Offset + Bytes) - 1,
>             &PrpListHost,
>             &PrpListNo,
>             &MapPrpList
>             );
>     if (Prp == NULL) {
>       goto EXIT;
>     }
> Status is not set to an error code - Status is initialized to
> EFI_SUCCESS, or set by a PciIo->Map to EFI_SUCCESS above this
> code. This error path should set Status to an error code before
> goto EXIT.
> 
> Cc: Hao Wu <hao.a.wu@intel.com>
> Cc: Ruiyu Ni <ruiyu.ni@intel.com>
> Cc: Michael Turner <Michael.Turner@microsoft.com>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Star Zeng <star.zeng@intel.com>
> ---
>  MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressPassthru.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressPassthru.c
> b/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressPassthru.c
> index 302cfdcd8d8d..cfad1587f299 100644
> --- a/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressPassthru.c
> +++ b/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressPassthru.c
> @@ -656,6 +656,7 @@ NvmExpressPassThru (
>      PhyAddr = (Sq->Prp[0] + EFI_PAGE_SIZE) & ~(EFI_PAGE_SIZE - 1);
>      Prp = NvmeCreatePrpList (PciIo, PhyAddr, EFI_SIZE_TO_PAGES(Offset + Bytes)
> - 1, &PrpListHost, &PrpListNo, &MapPrpList);
>      if (Prp == NULL) {
> +      Status = EFI_OUT_OF_RESOURCES;
>        goto EXIT;
>      }
> 
> --
> 2.7.0.windows.1



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-04-23 11:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-04-23  8:17 [PATCH] MdeModulePkg NvmExpressDxe: return error code in error path Star Zeng
2018-04-23 11:25 ` Wu, Hao A

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox