[edk2] [PATCH v2] TFTP : tftp fix for full volume case

Meenakshi Aggarwal posted 1 patch 6 years, 7 months ago
Failed in applying to current master (apply log)
ShellPkg/Library/UefiShellTftpCommandLib/Tftp.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
[edk2] [PATCH v2] TFTP : tftp fix for full volume case
Posted by Meenakshi Aggarwal 6 years, 7 months ago
Issue :
When storage media is full, tftp was resulting in ASSERT
MdeModulePkg/Core/Dxe/Mem/Page.c, because number of pages
was zero.

Reason:
While doing tftp, function call ShellWriteFile was modifying
FileSize variable. In case of full disk it was coming out to be
Zero.

Fix:
Storage the original filesize in local variable, and use this
variable while freeing the pages.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Udit Kumar <udit.kumar@nxp.com>
Signed-off-by: Meenakshi Aggarwal <meenakshi.aggarwal@nxp.com>
Signed-off-by: Vabhav Sharma <vabhav.sharma@nxp.com>
Signed-off-by: Meenakshi Aggarwal <meenakshi.aggarwal@nxp.com>
---
 ShellPkg/Library/UefiShellTftpCommandLib/Tftp.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/ShellPkg/Library/UefiShellTftpCommandLib/Tftp.c b/ShellPkg/Library/UefiShellTftpCommandLib/Tftp.c
index 5c50797..fbde3bf 100755
--- a/ShellPkg/Library/UefiShellTftpCommandLib/Tftp.c
+++ b/ShellPkg/Library/UefiShellTftpCommandLib/Tftp.c
@@ -284,6 +284,7 @@ ShellCommandRunTftp (
   EFI_HANDLE              Mtftp4ChildHandle;
   EFI_MTFTP4_PROTOCOL     *Mtftp4;
   UINTN                   FileSize;
+  UINTN                   DataSize;
   VOID                    *Data;
   SHELL_FILE_HANDLE       FileHandle;
   UINT16                  BlockSize;
@@ -294,6 +295,7 @@ ShellCommandRunTftp (
   AsciiRemoteFilePath = NULL;
   Handles             = NULL;
   FileSize            = 0;
+  DataSize            = 0;
   BlockSize           = MTFTP_DEFAULT_BLKSIZE;
 
   //
@@ -537,6 +539,7 @@ ShellCommandRunTftp (
       goto NextHandle;
     }
 
+    DataSize = FileSize;
     Status = ShellWriteFile (FileHandle, &FileSize, Data);
     if (!EFI_ERROR (Status)) {
       ShellStatus = SHELL_SUCCESS;
@@ -551,7 +554,7 @@ ShellCommandRunTftp (
     NextHandle:
 
     if (Data != NULL) {
-      gBS->FreePages ((EFI_PHYSICAL_ADDRESS)(UINTN)Data, EFI_SIZE_TO_PAGES (FileSize));
+      gBS->FreePages ((EFI_PHYSICAL_ADDRESS)(UINTN)Data, EFI_SIZE_TO_PAGES (DataSize));
     }
 
     CloseProtocolAndDestroyServiceChild (
-- 
1.9.1

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [PATCH v2] TFTP : tftp fix for full volume case
Posted by Fu, Siyuan 6 years, 7 months ago
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>

-----Original Message-----
From: Meenakshi Aggarwal [mailto:meenakshi.aggarwal@nxp.com] 
Sent: Monday, September 25, 2017 11:06 PM
To: edk2-devel@lists.01.org; Ni, Ruiyu <ruiyu.ni@intel.com>; Carsey, Jaben <jaben.carsey@intel.com>
Cc: ard.biesheuvel@linaro.org; leif.lindholm@linaro.org; Fu, Siyuan <siyuan.fu@intel.com>; Ye, Ting <ting.ye@intel.com>; Meenakshi Aggarwal <meenakshi.aggarwal@nxp.com>; Udit Kumar <udit.kumar@nxp.com>; Vabhav Sharma <vabhav.sharma@nxp.com>
Subject: [PATCH v2] TFTP : tftp fix for full volume case

Issue :
When storage media is full, tftp was resulting in ASSERT
MdeModulePkg/Core/Dxe/Mem/Page.c, because number of pages
was zero.

Reason:
While doing tftp, function call ShellWriteFile was modifying
FileSize variable. In case of full disk it was coming out to be
Zero.

Fix:
Storage the original filesize in local variable, and use this
variable while freeing the pages.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Udit Kumar <udit.kumar@nxp.com>
Signed-off-by: Meenakshi Aggarwal <meenakshi.aggarwal@nxp.com>
Signed-off-by: Vabhav Sharma <vabhav.sharma@nxp.com>
Signed-off-by: Meenakshi Aggarwal <meenakshi.aggarwal@nxp.com>
---
 ShellPkg/Library/UefiShellTftpCommandLib/Tftp.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/ShellPkg/Library/UefiShellTftpCommandLib/Tftp.c b/ShellPkg/Library/UefiShellTftpCommandLib/Tftp.c
index 5c50797..fbde3bf 100755
--- a/ShellPkg/Library/UefiShellTftpCommandLib/Tftp.c
+++ b/ShellPkg/Library/UefiShellTftpCommandLib/Tftp.c
@@ -284,6 +284,7 @@ ShellCommandRunTftp (
   EFI_HANDLE              Mtftp4ChildHandle;
   EFI_MTFTP4_PROTOCOL     *Mtftp4;
   UINTN                   FileSize;
+  UINTN                   DataSize;
   VOID                    *Data;
   SHELL_FILE_HANDLE       FileHandle;
   UINT16                  BlockSize;
@@ -294,6 +295,7 @@ ShellCommandRunTftp (
   AsciiRemoteFilePath = NULL;
   Handles             = NULL;
   FileSize            = 0;
+  DataSize            = 0;
   BlockSize           = MTFTP_DEFAULT_BLKSIZE;
 
   //
@@ -537,6 +539,7 @@ ShellCommandRunTftp (
       goto NextHandle;
     }
 
+    DataSize = FileSize;
     Status = ShellWriteFile (FileHandle, &FileSize, Data);
     if (!EFI_ERROR (Status)) {
       ShellStatus = SHELL_SUCCESS;
@@ -551,7 +554,7 @@ ShellCommandRunTftp (
     NextHandle:
 
     if (Data != NULL) {
-      gBS->FreePages ((EFI_PHYSICAL_ADDRESS)(UINTN)Data, EFI_SIZE_TO_PAGES (FileSize));
+      gBS->FreePages ((EFI_PHYSICAL_ADDRESS)(UINTN)Data, EFI_SIZE_TO_PAGES (DataSize));
     }
 
     CloseProtocolAndDestroyServiceChild (
-- 
1.9.1

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [PATCH v2] TFTP : tftp fix for full volume case
Posted by Meenakshi Aggarwal 6 years, 7 months ago
Hi,

Thanks for the review Siyuan.


Ting,

Any comment from your side?

Thanks,
Meenakshi

> -----Original Message-----
> From: Fu, Siyuan [mailto:siyuan.fu@intel.com]
> Sent: Tuesday, September 26, 2017 6:12 AM
> To: Meenakshi Aggarwal <meenakshi.aggarwal@nxp.com>; edk2-
> devel@lists.01.org; Ni, Ruiyu <ruiyu.ni@intel.com>; Carsey, Jaben
> <jaben.carsey@intel.com>
> Cc: ard.biesheuvel@linaro.org; leif.lindholm@linaro.org; Ye, Ting
> <ting.ye@intel.com>; Udit Kumar <udit.kumar@nxp.com>; Vabhav Sharma
> <vabhav.sharma@nxp.com>
> Subject: RE: [PATCH v2] TFTP : tftp fix for full volume case
> 
> Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
> 
> -----Original Message-----
> From: Meenakshi Aggarwal [mailto:meenakshi.aggarwal@nxp.com]
> Sent: Monday, September 25, 2017 11:06 PM
> To: edk2-devel@lists.01.org; Ni, Ruiyu <ruiyu.ni@intel.com>; Carsey, Jaben
> <jaben.carsey@intel.com>
> Cc: ard.biesheuvel@linaro.org; leif.lindholm@linaro.org; Fu, Siyuan
> <siyuan.fu@intel.com>; Ye, Ting <ting.ye@intel.com>; Meenakshi Aggarwal
> <meenakshi.aggarwal@nxp.com>; Udit Kumar <udit.kumar@nxp.com>;
> Vabhav Sharma <vabhav.sharma@nxp.com>
> Subject: [PATCH v2] TFTP : tftp fix for full volume case
> 
> Issue :
> When storage media is full, tftp was resulting in ASSERT
> MdeModulePkg/Core/Dxe/Mem/Page.c, because number of pages was
> zero.
> 
> Reason:
> While doing tftp, function call ShellWriteFile was modifying FileSize variable.
> In case of full disk it was coming out to be Zero.
> 
> Fix:
> Storage the original filesize in local variable, and use this variable while
> freeing the pages.
> 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Udit Kumar <udit.kumar@nxp.com>
> Signed-off-by: Meenakshi Aggarwal <meenakshi.aggarwal@nxp.com>
> Signed-off-by: Vabhav Sharma <vabhav.sharma@nxp.com>
> Signed-off-by: Meenakshi Aggarwal <meenakshi.aggarwal@nxp.com>
> ---
>  ShellPkg/Library/UefiShellTftpCommandLib/Tftp.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/ShellPkg/Library/UefiShellTftpCommandLib/Tftp.c
> b/ShellPkg/Library/UefiShellTftpCommandLib/Tftp.c
> index 5c50797..fbde3bf 100755
> --- a/ShellPkg/Library/UefiShellTftpCommandLib/Tftp.c
> +++ b/ShellPkg/Library/UefiShellTftpCommandLib/Tftp.c
> @@ -284,6 +284,7 @@ ShellCommandRunTftp (
>    EFI_HANDLE              Mtftp4ChildHandle;
>    EFI_MTFTP4_PROTOCOL     *Mtftp4;
>    UINTN                   FileSize;
> +  UINTN                   DataSize;
>    VOID                    *Data;
>    SHELL_FILE_HANDLE       FileHandle;
>    UINT16                  BlockSize;
> @@ -294,6 +295,7 @@ ShellCommandRunTftp (
>    AsciiRemoteFilePath = NULL;
>    Handles             = NULL;
>    FileSize            = 0;
> +  DataSize            = 0;
>    BlockSize           = MTFTP_DEFAULT_BLKSIZE;
> 
>    //
> @@ -537,6 +539,7 @@ ShellCommandRunTftp (
>        goto NextHandle;
>      }
> 
> +    DataSize = FileSize;
>      Status = ShellWriteFile (FileHandle, &FileSize, Data);
>      if (!EFI_ERROR (Status)) {
>        ShellStatus = SHELL_SUCCESS;
> @@ -551,7 +554,7 @@ ShellCommandRunTftp (
>      NextHandle:
> 
>      if (Data != NULL) {
> -      gBS->FreePages ((EFI_PHYSICAL_ADDRESS)(UINTN)Data,
> EFI_SIZE_TO_PAGES (FileSize));
> +      gBS->FreePages ((EFI_PHYSICAL_ADDRESS)(UINTN)Data,
> + EFI_SIZE_TO_PAGES (DataSize));
>      }
> 
>      CloseProtocolAndDestroyServiceChild (
> --
> 1.9.1

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [PATCH v2] TFTP : tftp fix for full volume case
Posted by Meenakshi Aggarwal 6 years, 6 months ago
Hi Team,


Any further comments on this patch?

Or is it ready to merge in edk2?


Thanks,
Meenakshi

> -----Original Message-----
> From: Meenakshi Aggarwal
> Sent: Wednesday, September 27, 2017 9:01 AM
> To: 'Fu, Siyuan' <siyuan.fu@intel.com>; edk2-devel@lists.01.org; Ni, Ruiyu
> <ruiyu.ni@intel.com>; Carsey, Jaben <jaben.carsey@intel.com>; Ye, Ting
> <ting.ye@intel.com>
> Cc: Udit Kumar <udit.kumar@nxp.com>; Vabhav Sharma
> <vabhav.sharma@nxp.com>
> Subject: RE: [PATCH v2] TFTP : tftp fix for full volume case
> 
> Hi,
> 
> Thanks for the review Siyuan.
> 
> 
> Ting,
> 
> Any comment from your side?
> 
> Thanks,
> Meenakshi
> 
> > -----Original Message-----
> > From: Fu, Siyuan [mailto:siyuan.fu@intel.com]
> > Sent: Tuesday, September 26, 2017 6:12 AM
> > To: Meenakshi Aggarwal <meenakshi.aggarwal@nxp.com>; edk2-
> > devel@lists.01.org; Ni, Ruiyu <ruiyu.ni@intel.com>; Carsey, Jaben
> > <jaben.carsey@intel.com>
> > Cc: ard.biesheuvel@linaro.org; leif.lindholm@linaro.org; Ye, Ting
> > <ting.ye@intel.com>; Udit Kumar <udit.kumar@nxp.com>; Vabhav Sharma
> > <vabhav.sharma@nxp.com>
> > Subject: RE: [PATCH v2] TFTP : tftp fix for full volume case
> >
> > Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
> >
> > -----Original Message-----
> > From: Meenakshi Aggarwal [mailto:meenakshi.aggarwal@nxp.com]
> > Sent: Monday, September 25, 2017 11:06 PM
> > To: edk2-devel@lists.01.org; Ni, Ruiyu <ruiyu.ni@intel.com>; Carsey,
> > Jaben <jaben.carsey@intel.com>
> > Cc: ard.biesheuvel@linaro.org; leif.lindholm@linaro.org; Fu, Siyuan
> > <siyuan.fu@intel.com>; Ye, Ting <ting.ye@intel.com>; Meenakshi
> > Aggarwal <meenakshi.aggarwal@nxp.com>; Udit Kumar
> > <udit.kumar@nxp.com>; Vabhav Sharma <vabhav.sharma@nxp.com>
> > Subject: [PATCH v2] TFTP : tftp fix for full volume case
> >
> > Issue :
> > When storage media is full, tftp was resulting in ASSERT
> > MdeModulePkg/Core/Dxe/Mem/Page.c, because number of pages was
> zero.
> >
> > Reason:
> > While doing tftp, function call ShellWriteFile was modifying FileSize variable.
> > In case of full disk it was coming out to be Zero.
> >
> > Fix:
> > Storage the original filesize in local variable, and use this variable
> > while freeing the pages.
> >
> > Contributed-under: TianoCore Contribution Agreement 1.1
> > Signed-off-by: Udit Kumar <udit.kumar@nxp.com>
> > Signed-off-by: Meenakshi Aggarwal <meenakshi.aggarwal@nxp.com>
> > Signed-off-by: Vabhav Sharma <vabhav.sharma@nxp.com>
> > Signed-off-by: Meenakshi Aggarwal <meenakshi.aggarwal@nxp.com>
> > ---
> >  ShellPkg/Library/UefiShellTftpCommandLib/Tftp.c | 5 ++++-
> >  1 file changed, 4 insertions(+), 1 deletion(-)
> >
> > diff --git a/ShellPkg/Library/UefiShellTftpCommandLib/Tftp.c
> > b/ShellPkg/Library/UefiShellTftpCommandLib/Tftp.c
> > index 5c50797..fbde3bf 100755
> > --- a/ShellPkg/Library/UefiShellTftpCommandLib/Tftp.c
> > +++ b/ShellPkg/Library/UefiShellTftpCommandLib/Tftp.c
> > @@ -284,6 +284,7 @@ ShellCommandRunTftp (
> >    EFI_HANDLE              Mtftp4ChildHandle;
> >    EFI_MTFTP4_PROTOCOL     *Mtftp4;
> >    UINTN                   FileSize;
> > +  UINTN                   DataSize;
> >    VOID                    *Data;
> >    SHELL_FILE_HANDLE       FileHandle;
> >    UINT16                  BlockSize;
> > @@ -294,6 +295,7 @@ ShellCommandRunTftp (
> >    AsciiRemoteFilePath = NULL;
> >    Handles             = NULL;
> >    FileSize            = 0;
> > +  DataSize            = 0;
> >    BlockSize           = MTFTP_DEFAULT_BLKSIZE;
> >
> >    //
> > @@ -537,6 +539,7 @@ ShellCommandRunTftp (
> >        goto NextHandle;
> >      }
> >
> > +    DataSize = FileSize;
> >      Status = ShellWriteFile (FileHandle, &FileSize, Data);
> >      if (!EFI_ERROR (Status)) {
> >        ShellStatus = SHELL_SUCCESS;
> > @@ -551,7 +554,7 @@ ShellCommandRunTftp (
> >      NextHandle:
> >
> >      if (Data != NULL) {
> > -      gBS->FreePages ((EFI_PHYSICAL_ADDRESS)(UINTN)Data,
> > EFI_SIZE_TO_PAGES (FileSize));
> > +      gBS->FreePages ((EFI_PHYSICAL_ADDRESS)(UINTN)Data,
> > + EFI_SIZE_TO_PAGES (DataSize));
> >      }
> >
> >      CloseProtocolAndDestroyServiceChild (
> > --
> > 1.9.1

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [PATCH v2] TFTP : tftp fix for full volume case
Posted by Carsey, Jaben 6 years, 6 months ago
I am fine. Ray?

Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>

> -----Original Message-----
> From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of
> Meenakshi Aggarwal
> Sent: Sunday, October 08, 2017 11:28 PM
> To: Fu, Siyuan <siyuan.fu@intel.com>; edk2-devel@lists.01.org; Ni, Ruiyu
> <ruiyu.ni@intel.com>; Carsey, Jaben <jaben.carsey@intel.com>; Ye, Ting
> <ting.ye@intel.com>
> Subject: Re: [edk2] [PATCH v2] TFTP : tftp fix for full volume case
> Importance: High
> 
> Hi Team,
> 
> 
> Any further comments on this patch?
> 
> Or is it ready to merge in edk2?
> 
> 
> Thanks,
> Meenakshi
> 
> > -----Original Message-----
> > From: Meenakshi Aggarwal
> > Sent: Wednesday, September 27, 2017 9:01 AM
> > To: 'Fu, Siyuan' <siyuan.fu@intel.com>; edk2-devel@lists.01.org; Ni, Ruiyu
> > <ruiyu.ni@intel.com>; Carsey, Jaben <jaben.carsey@intel.com>; Ye, Ting
> > <ting.ye@intel.com>
> > Cc: Udit Kumar <udit.kumar@nxp.com>; Vabhav Sharma
> > <vabhav.sharma@nxp.com>
> > Subject: RE: [PATCH v2] TFTP : tftp fix for full volume case
> >
> > Hi,
> >
> > Thanks for the review Siyuan.
> >
> >
> > Ting,
> >
> > Any comment from your side?
> >
> > Thanks,
> > Meenakshi
> >
> > > -----Original Message-----
> > > From: Fu, Siyuan [mailto:siyuan.fu@intel.com]
> > > Sent: Tuesday, September 26, 2017 6:12 AM
> > > To: Meenakshi Aggarwal <meenakshi.aggarwal@nxp.com>; edk2-
> > > devel@lists.01.org; Ni, Ruiyu <ruiyu.ni@intel.com>; Carsey, Jaben
> > > <jaben.carsey@intel.com>
> > > Cc: ard.biesheuvel@linaro.org; leif.lindholm@linaro.org; Ye, Ting
> > > <ting.ye@intel.com>; Udit Kumar <udit.kumar@nxp.com>; Vabhav
> Sharma
> > > <vabhav.sharma@nxp.com>
> > > Subject: RE: [PATCH v2] TFTP : tftp fix for full volume case
> > >
> > > Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
> > >
> > > -----Original Message-----
> > > From: Meenakshi Aggarwal [mailto:meenakshi.aggarwal@nxp.com]
> > > Sent: Monday, September 25, 2017 11:06 PM
> > > To: edk2-devel@lists.01.org; Ni, Ruiyu <ruiyu.ni@intel.com>; Carsey,
> > > Jaben <jaben.carsey@intel.com>
> > > Cc: ard.biesheuvel@linaro.org; leif.lindholm@linaro.org; Fu, Siyuan
> > > <siyuan.fu@intel.com>; Ye, Ting <ting.ye@intel.com>; Meenakshi
> > > Aggarwal <meenakshi.aggarwal@nxp.com>; Udit Kumar
> > > <udit.kumar@nxp.com>; Vabhav Sharma <vabhav.sharma@nxp.com>
> > > Subject: [PATCH v2] TFTP : tftp fix for full volume case
> > >
> > > Issue :
> > > When storage media is full, tftp was resulting in ASSERT
> > > MdeModulePkg/Core/Dxe/Mem/Page.c, because number of pages was
> > zero.
> > >
> > > Reason:
> > > While doing tftp, function call ShellWriteFile was modifying FileSize
> variable.
> > > In case of full disk it was coming out to be Zero.
> > >
> > > Fix:
> > > Storage the original filesize in local variable, and use this variable
> > > while freeing the pages.
> > >
> > > Contributed-under: TianoCore Contribution Agreement 1.1
> > > Signed-off-by: Udit Kumar <udit.kumar@nxp.com>
> > > Signed-off-by: Meenakshi Aggarwal <meenakshi.aggarwal@nxp.com>
> > > Signed-off-by: Vabhav Sharma <vabhav.sharma@nxp.com>
> > > Signed-off-by: Meenakshi Aggarwal <meenakshi.aggarwal@nxp.com>
> > > ---
> > >  ShellPkg/Library/UefiShellTftpCommandLib/Tftp.c | 5 ++++-
> > >  1 file changed, 4 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/ShellPkg/Library/UefiShellTftpCommandLib/Tftp.c
> > > b/ShellPkg/Library/UefiShellTftpCommandLib/Tftp.c
> > > index 5c50797..fbde3bf 100755
> > > --- a/ShellPkg/Library/UefiShellTftpCommandLib/Tftp.c
> > > +++ b/ShellPkg/Library/UefiShellTftpCommandLib/Tftp.c
> > > @@ -284,6 +284,7 @@ ShellCommandRunTftp (
> > >    EFI_HANDLE              Mtftp4ChildHandle;
> > >    EFI_MTFTP4_PROTOCOL     *Mtftp4;
> > >    UINTN                   FileSize;
> > > +  UINTN                   DataSize;
> > >    VOID                    *Data;
> > >    SHELL_FILE_HANDLE       FileHandle;
> > >    UINT16                  BlockSize;
> > > @@ -294,6 +295,7 @@ ShellCommandRunTftp (
> > >    AsciiRemoteFilePath = NULL;
> > >    Handles             = NULL;
> > >    FileSize            = 0;
> > > +  DataSize            = 0;
> > >    BlockSize           = MTFTP_DEFAULT_BLKSIZE;
> > >
> > >    //
> > > @@ -537,6 +539,7 @@ ShellCommandRunTftp (
> > >        goto NextHandle;
> > >      }
> > >
> > > +    DataSize = FileSize;
> > >      Status = ShellWriteFile (FileHandle, &FileSize, Data);
> > >      if (!EFI_ERROR (Status)) {
> > >        ShellStatus = SHELL_SUCCESS;
> > > @@ -551,7 +554,7 @@ ShellCommandRunTftp (
> > >      NextHandle:
> > >
> > >      if (Data != NULL) {
> > > -      gBS->FreePages ((EFI_PHYSICAL_ADDRESS)(UINTN)Data,
> > > EFI_SIZE_TO_PAGES (FileSize));
> > > +      gBS->FreePages ((EFI_PHYSICAL_ADDRESS)(UINTN)Data,
> > > + EFI_SIZE_TO_PAGES (DataSize));
> > >      }
> > >
> > >      CloseProtocolAndDestroyServiceChild (
> > > --
> > > 1.9.1
> 
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [PATCH v2] TFTP : tftp fix for full volume case
Posted by Ni, Ruiyu 6 years, 6 months ago
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>

Thanks/Ray

> -----Original Message-----
> From: Carsey, Jaben
> Sent: Monday, October 9, 2017 10:13 PM
> To: Meenakshi Aggarwal <meenakshi.aggarwal@nxp.com>; Fu, Siyuan
> <siyuan.fu@intel.com>; edk2-devel@lists.01.org; Ni, Ruiyu
> <ruiyu.ni@intel.com>; Ye, Ting <ting.ye@intel.com>
> Subject: RE: [PATCH v2] TFTP : tftp fix for full volume case
> 
> I am fine. Ray?
> 
> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
> 
> > -----Original Message-----
> > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of
> > Meenakshi Aggarwal
> > Sent: Sunday, October 08, 2017 11:28 PM
> > To: Fu, Siyuan <siyuan.fu@intel.com>; edk2-devel@lists.01.org; Ni,
> > Ruiyu <ruiyu.ni@intel.com>; Carsey, Jaben <jaben.carsey@intel.com>;
> > Ye, Ting <ting.ye@intel.com>
> > Subject: Re: [edk2] [PATCH v2] TFTP : tftp fix for full volume case
> > Importance: High
> >
> > Hi Team,
> >
> >
> > Any further comments on this patch?
> >
> > Or is it ready to merge in edk2?
> >
> >
> > Thanks,
> > Meenakshi
> >
> > > -----Original Message-----
> > > From: Meenakshi Aggarwal
> > > Sent: Wednesday, September 27, 2017 9:01 AM
> > > To: 'Fu, Siyuan' <siyuan.fu@intel.com>; edk2-devel@lists.01.org; Ni,
> > > Ruiyu <ruiyu.ni@intel.com>; Carsey, Jaben <jaben.carsey@intel.com>;
> > > Ye, Ting <ting.ye@intel.com>
> > > Cc: Udit Kumar <udit.kumar@nxp.com>; Vabhav Sharma
> > > <vabhav.sharma@nxp.com>
> > > Subject: RE: [PATCH v2] TFTP : tftp fix for full volume case
> > >
> > > Hi,
> > >
> > > Thanks for the review Siyuan.
> > >
> > >
> > > Ting,
> > >
> > > Any comment from your side?
> > >
> > > Thanks,
> > > Meenakshi
> > >
> > > > -----Original Message-----
> > > > From: Fu, Siyuan [mailto:siyuan.fu@intel.com]
> > > > Sent: Tuesday, September 26, 2017 6:12 AM
> > > > To: Meenakshi Aggarwal <meenakshi.aggarwal@nxp.com>; edk2-
> > > > devel@lists.01.org; Ni, Ruiyu <ruiyu.ni@intel.com>; Carsey, Jaben
> > > > <jaben.carsey@intel.com>
> > > > Cc: ard.biesheuvel@linaro.org; leif.lindholm@linaro.org; Ye, Ting
> > > > <ting.ye@intel.com>; Udit Kumar <udit.kumar@nxp.com>; Vabhav
> > Sharma
> > > > <vabhav.sharma@nxp.com>
> > > > Subject: RE: [PATCH v2] TFTP : tftp fix for full volume case
> > > >
> > > > Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
> > > >
> > > > -----Original Message-----
> > > > From: Meenakshi Aggarwal [mailto:meenakshi.aggarwal@nxp.com]
> > > > Sent: Monday, September 25, 2017 11:06 PM
> > > > To: edk2-devel@lists.01.org; Ni, Ruiyu <ruiyu.ni@intel.com>;
> > > > Carsey, Jaben <jaben.carsey@intel.com>
> > > > Cc: ard.biesheuvel@linaro.org; leif.lindholm@linaro.org; Fu,
> > > > Siyuan <siyuan.fu@intel.com>; Ye, Ting <ting.ye@intel.com>;
> > > > Meenakshi Aggarwal <meenakshi.aggarwal@nxp.com>; Udit Kumar
> > > > <udit.kumar@nxp.com>; Vabhav Sharma <vabhav.sharma@nxp.com>
> > > > Subject: [PATCH v2] TFTP : tftp fix for full volume case
> > > >
> > > > Issue :
> > > > When storage media is full, tftp was resulting in ASSERT
> > > > MdeModulePkg/Core/Dxe/Mem/Page.c, because number of pages was
> > > zero.
> > > >
> > > > Reason:
> > > > While doing tftp, function call ShellWriteFile was modifying
> > > > FileSize
> > variable.
> > > > In case of full disk it was coming out to be Zero.
> > > >
> > > > Fix:
> > > > Storage the original filesize in local variable, and use this
> > > > variable while freeing the pages.
> > > >
> > > > Contributed-under: TianoCore Contribution Agreement 1.1
> > > > Signed-off-by: Udit Kumar <udit.kumar@nxp.com>
> > > > Signed-off-by: Meenakshi Aggarwal <meenakshi.aggarwal@nxp.com>
> > > > Signed-off-by: Vabhav Sharma <vabhav.sharma@nxp.com>
> > > > Signed-off-by: Meenakshi Aggarwal <meenakshi.aggarwal@nxp.com>
> > > > ---
> > > >  ShellPkg/Library/UefiShellTftpCommandLib/Tftp.c | 5 ++++-
> > > >  1 file changed, 4 insertions(+), 1 deletion(-)
> > > >
> > > > diff --git a/ShellPkg/Library/UefiShellTftpCommandLib/Tftp.c
> > > > b/ShellPkg/Library/UefiShellTftpCommandLib/Tftp.c
> > > > index 5c50797..fbde3bf 100755
> > > > --- a/ShellPkg/Library/UefiShellTftpCommandLib/Tftp.c
> > > > +++ b/ShellPkg/Library/UefiShellTftpCommandLib/Tftp.c
> > > > @@ -284,6 +284,7 @@ ShellCommandRunTftp (
> > > >    EFI_HANDLE              Mtftp4ChildHandle;
> > > >    EFI_MTFTP4_PROTOCOL     *Mtftp4;
> > > >    UINTN                   FileSize;
> > > > +  UINTN                   DataSize;
> > > >    VOID                    *Data;
> > > >    SHELL_FILE_HANDLE       FileHandle;
> > > >    UINT16                  BlockSize;
> > > > @@ -294,6 +295,7 @@ ShellCommandRunTftp (
> > > >    AsciiRemoteFilePath = NULL;
> > > >    Handles             = NULL;
> > > >    FileSize            = 0;
> > > > +  DataSize            = 0;
> > > >    BlockSize           = MTFTP_DEFAULT_BLKSIZE;
> > > >
> > > >    //
> > > > @@ -537,6 +539,7 @@ ShellCommandRunTftp (
> > > >        goto NextHandle;
> > > >      }
> > > >
> > > > +    DataSize = FileSize;
> > > >      Status = ShellWriteFile (FileHandle, &FileSize, Data);
> > > >      if (!EFI_ERROR (Status)) {
> > > >        ShellStatus = SHELL_SUCCESS; @@ -551,7 +554,7 @@
> > > > ShellCommandRunTftp (
> > > >      NextHandle:
> > > >
> > > >      if (Data != NULL) {
> > > > -      gBS->FreePages ((EFI_PHYSICAL_ADDRESS)(UINTN)Data,
> > > > EFI_SIZE_TO_PAGES (FileSize));
> > > > +      gBS->FreePages ((EFI_PHYSICAL_ADDRESS)(UINTN)Data,
> > > > + EFI_SIZE_TO_PAGES (DataSize));
> > > >      }
> > > >
> > > >      CloseProtocolAndDestroyServiceChild (
> > > > --
> > > > 1.9.1
> >
> > _______________________________________________
> > edk2-devel mailing list
> > edk2-devel@lists.01.org
> > https://lists.01.org/mailman/listinfo/edk2-devel
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [PATCH v2] TFTP : tftp fix for full volume case
Posted by Meenakshi Aggarwal 6 years, 6 months ago
Hi,


Kindly apply this patch on edk2 if all reviews are done.


Thanks & Regards,
Meenakshi

> -----Original Message-----
> From: Ni, Ruiyu [mailto:ruiyu.ni@intel.com]
> Sent: Tuesday, October 10, 2017 10:52 AM
> To: Carsey, Jaben <jaben.carsey@intel.com>; Meenakshi Aggarwal
> <meenakshi.aggarwal@nxp.com>; Fu, Siyuan <siyuan.fu@intel.com>; edk2-
> devel@lists.01.org; Ye, Ting <ting.ye@intel.com>
> Subject: RE: [PATCH v2] TFTP : tftp fix for full volume case
> 
> Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
> 
> Thanks/Ray
> 
> > -----Original Message-----
> > From: Carsey, Jaben
> > Sent: Monday, October 9, 2017 10:13 PM
> > To: Meenakshi Aggarwal <meenakshi.aggarwal@nxp.com>; Fu, Siyuan
> > <siyuan.fu@intel.com>; edk2-devel@lists.01.org; Ni, Ruiyu
> > <ruiyu.ni@intel.com>; Ye, Ting <ting.ye@intel.com>
> > Subject: RE: [PATCH v2] TFTP : tftp fix for full volume case
> >
> > I am fine. Ray?
> >
> > Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
> >
> > > -----Original Message-----
> > > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf
> > > Of Meenakshi Aggarwal
> > > Sent: Sunday, October 08, 2017 11:28 PM
> > > To: Fu, Siyuan <siyuan.fu@intel.com>; edk2-devel@lists.01.org; Ni,
> > > Ruiyu <ruiyu.ni@intel.com>; Carsey, Jaben <jaben.carsey@intel.com>;
> > > Ye, Ting <ting.ye@intel.com>
> > > Subject: Re: [edk2] [PATCH v2] TFTP : tftp fix for full volume case
> > > Importance: High
> > >
> > > Hi Team,
> > >
> > >
> > > Any further comments on this patch?
> > >
> > > Or is it ready to merge in edk2?
> > >
> > >
> > > Thanks,
> > > Meenakshi
> > >
> > > > -----Original Message-----
> > > > From: Meenakshi Aggarwal
> > > > Sent: Wednesday, September 27, 2017 9:01 AM
> > > > To: 'Fu, Siyuan' <siyuan.fu@intel.com>; edk2-devel@lists.01.org;
> > > > Ni, Ruiyu <ruiyu.ni@intel.com>; Carsey, Jaben
> > > > <jaben.carsey@intel.com>; Ye, Ting <ting.ye@intel.com>
> > > > Cc: Udit Kumar <udit.kumar@nxp.com>; Vabhav Sharma
> > > > <vabhav.sharma@nxp.com>
> > > > Subject: RE: [PATCH v2] TFTP : tftp fix for full volume case
> > > >
> > > > Hi,
> > > >
> > > > Thanks for the review Siyuan.
> > > >
> > > >
> > > > Ting,
> > > >
> > > > Any comment from your side?
> > > >
> > > > Thanks,
> > > > Meenakshi
> > > >
> > > > > -----Original Message-----
> > > > > From: Fu, Siyuan [mailto:siyuan.fu@intel.com]
> > > > > Sent: Tuesday, September 26, 2017 6:12 AM
> > > > > To: Meenakshi Aggarwal <meenakshi.aggarwal@nxp.com>; edk2-
> > > > > devel@lists.01.org; Ni, Ruiyu <ruiyu.ni@intel.com>; Carsey,
> > > > > Jaben <jaben.carsey@intel.com>
> > > > > Cc: ard.biesheuvel@linaro.org; leif.lindholm@linaro.org; Ye,
> > > > > Ting <ting.ye@intel.com>; Udit Kumar <udit.kumar@nxp.com>;
> > > > > Vabhav
> > > Sharma
> > > > > <vabhav.sharma@nxp.com>
> > > > > Subject: RE: [PATCH v2] TFTP : tftp fix for full volume case
> > > > >
> > > > > Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
> > > > >
> > > > > -----Original Message-----
> > > > > From: Meenakshi Aggarwal [mailto:meenakshi.aggarwal@nxp.com]
> > > > > Sent: Monday, September 25, 2017 11:06 PM
> > > > > To: edk2-devel@lists.01.org; Ni, Ruiyu <ruiyu.ni@intel.com>;
> > > > > Carsey, Jaben <jaben.carsey@intel.com>
> > > > > Cc: ard.biesheuvel@linaro.org; leif.lindholm@linaro.org; Fu,
> > > > > Siyuan <siyuan.fu@intel.com>; Ye, Ting <ting.ye@intel.com>;
> > > > > Meenakshi Aggarwal <meenakshi.aggarwal@nxp.com>; Udit Kumar
> > > > > <udit.kumar@nxp.com>; Vabhav Sharma
> <vabhav.sharma@nxp.com>
> > > > > Subject: [PATCH v2] TFTP : tftp fix for full volume case
> > > > >
> > > > > Issue :
> > > > > When storage media is full, tftp was resulting in ASSERT
> > > > > MdeModulePkg/Core/Dxe/Mem/Page.c, because number of pages
> was
> > > > zero.
> > > > >
> > > > > Reason:
> > > > > While doing tftp, function call ShellWriteFile was modifying
> > > > > FileSize
> > > variable.
> > > > > In case of full disk it was coming out to be Zero.
> > > > >
> > > > > Fix:
> > > > > Storage the original filesize in local variable, and use this
> > > > > variable while freeing the pages.
> > > > >
> > > > > Contributed-under: TianoCore Contribution Agreement 1.1
> > > > > Signed-off-by: Udit Kumar <udit.kumar@nxp.com>
> > > > > Signed-off-by: Meenakshi Aggarwal
> <meenakshi.aggarwal@nxp.com>
> > > > > Signed-off-by: Vabhav Sharma <vabhav.sharma@nxp.com>
> > > > > Signed-off-by: Meenakshi Aggarwal
> <meenakshi.aggarwal@nxp.com>
> > > > > ---
> > > > >  ShellPkg/Library/UefiShellTftpCommandLib/Tftp.c | 5 ++++-
> > > > >  1 file changed, 4 insertions(+), 1 deletion(-)
> > > > >
> > > > > diff --git a/ShellPkg/Library/UefiShellTftpCommandLib/Tftp.c
> > > > > b/ShellPkg/Library/UefiShellTftpCommandLib/Tftp.c
> > > > > index 5c50797..fbde3bf 100755
> > > > > --- a/ShellPkg/Library/UefiShellTftpCommandLib/Tftp.c
> > > > > +++ b/ShellPkg/Library/UefiShellTftpCommandLib/Tftp.c
> > > > > @@ -284,6 +284,7 @@ ShellCommandRunTftp (
> > > > >    EFI_HANDLE              Mtftp4ChildHandle;
> > > > >    EFI_MTFTP4_PROTOCOL     *Mtftp4;
> > > > >    UINTN                   FileSize;
> > > > > +  UINTN                   DataSize;
> > > > >    VOID                    *Data;
> > > > >    SHELL_FILE_HANDLE       FileHandle;
> > > > >    UINT16                  BlockSize;
> > > > > @@ -294,6 +295,7 @@ ShellCommandRunTftp (
> > > > >    AsciiRemoteFilePath = NULL;
> > > > >    Handles             = NULL;
> > > > >    FileSize            = 0;
> > > > > +  DataSize            = 0;
> > > > >    BlockSize           = MTFTP_DEFAULT_BLKSIZE;
> > > > >
> > > > >    //
> > > > > @@ -537,6 +539,7 @@ ShellCommandRunTftp (
> > > > >        goto NextHandle;
> > > > >      }
> > > > >
> > > > > +    DataSize = FileSize;
> > > > >      Status = ShellWriteFile (FileHandle, &FileSize, Data);
> > > > >      if (!EFI_ERROR (Status)) {
> > > > >        ShellStatus = SHELL_SUCCESS; @@ -551,7 +554,7 @@
> > > > > ShellCommandRunTftp (
> > > > >      NextHandle:
> > > > >
> > > > >      if (Data != NULL) {
> > > > > -      gBS->FreePages ((EFI_PHYSICAL_ADDRESS)(UINTN)Data,
> > > > > EFI_SIZE_TO_PAGES (FileSize));
> > > > > +      gBS->FreePages ((EFI_PHYSICAL_ADDRESS)(UINTN)Data,
> > > > > + EFI_SIZE_TO_PAGES (DataSize));
> > > > >      }
> > > > >
> > > > >      CloseProtocolAndDestroyServiceChild (
> > > > > --
> > > > > 1.9.1
> > >
> > > _______________________________________________
> > > edk2-devel mailing list
> > > edk2-devel@lists.01.org
> > > https://lists.01.org/mailman/listinfo/edk2-devel
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel