* [Patch] ShellPkg/TftpDynamicCommand: Fix the potentially uninitialized local variable used. @ 2018-09-27 14:42 Jiaxin Wu 2018-09-28 2:30 ` Zeng, Star 0 siblings, 1 reply; 3+ messages in thread From: Jiaxin Wu @ 2018-09-27 14:42 UTC (permalink / raw) To: edk2-devel; +Cc: Ye Ting, Fu Siyuan, Carsey Jaben, Zeng Star, Wu Jiaxin Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1217 Local variable 'Mtftp4Token' might be uninitialized when error happen. This patch is to resolve the issue. Cc: Ye Ting <ting.ye@intel.com> Cc: Fu Siyuan <siyuan.fu@intel.com> Cc: Carsey Jaben <jaben.carsey@intel.com> Cc: Zeng Star <star.zeng@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Wu Jiaxin <jiaxin.wu@intel.com> --- ShellPkg/DynamicCommand/TftpDynamicCommand/Tftp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ShellPkg/DynamicCommand/TftpDynamicCommand/Tftp.c b/ShellPkg/DynamicCommand/TftpDynamicCommand/Tftp.c index c66be6b9d9..d4391b9f33 100644 --- a/ShellPkg/DynamicCommand/TftpDynamicCommand/Tftp.c +++ b/ShellPkg/DynamicCommand/TftpDynamicCommand/Tftp.c @@ -934,10 +934,12 @@ DownloadFile ( DOWNLOAD_CONTEXT *TftpContext; EFI_MTFTP4_TOKEN Mtftp4Token; UINT8 BlksizeBuf[10]; UINT8 WindowsizeBuf[10]; + ZeroMem (&Mtftp4Token, sizeof (EFI_MTFTP4_TOKEN)); + // Downloaded file can be large. BS.AllocatePages() is more faster // than AllocatePool() and avoid fragmentation. // The downloaded file could be an EFI application. Marking the // allocated page as EfiBootServicesCode would allow to execute a // potential downloaded EFI application. @@ -959,11 +961,10 @@ DownloadFile ( } TftpContext->FileSize = FileSize; TftpContext->DownloadedNbOfBytes = 0; TftpContext->LastReportedNbOfBytes = 0; - ZeroMem (&Mtftp4Token, sizeof (EFI_MTFTP4_TOKEN)); Mtftp4Token.Filename = (UINT8*)AsciiFilePath; Mtftp4Token.BufferSize = FileSize; Mtftp4Token.Buffer = Buffer; Mtftp4Token.CheckPacket = CheckPacket; Mtftp4Token.Context = (VOID*)TftpContext; -- 2.17.1.windows.2 ^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Patch] ShellPkg/TftpDynamicCommand: Fix the potentially uninitialized local variable used. 2018-09-27 14:42 [Patch] ShellPkg/TftpDynamicCommand: Fix the potentially uninitialized local variable used Jiaxin Wu @ 2018-09-28 2:30 ` Zeng, Star 2018-09-28 2:51 ` Wu, Jiaxin 0 siblings, 1 reply; 3+ messages in thread From: Zeng, Star @ 2018-09-28 2:30 UTC (permalink / raw) To: Wu, Jiaxin, edk2-devel@lists.01.org Cc: Ye, Ting, Fu, Siyuan, Carsey, Jaben, Zeng, Star Reviewed-by: Star Zeng <star.zeng@intel.com> -----Original Message----- From: Wu, Jiaxin Sent: Thursday, September 27, 2018 10:42 PM To: edk2-devel@lists.01.org Cc: Ye, Ting <ting.ye@intel.com>; Fu, Siyuan <siyuan.fu@intel.com>; Carsey, Jaben <jaben.carsey@intel.com>; Zeng, Star <star.zeng@intel.com>; Wu, Jiaxin <jiaxin.wu@intel.com> Subject: [Patch] ShellPkg/TftpDynamicCommand: Fix the potentially uninitialized local variable used. Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1217 Local variable 'Mtftp4Token' might be uninitialized when error happen. This patch is to resolve the issue. Cc: Ye Ting <ting.ye@intel.com> Cc: Fu Siyuan <siyuan.fu@intel.com> Cc: Carsey Jaben <jaben.carsey@intel.com> Cc: Zeng Star <star.zeng@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Wu Jiaxin <jiaxin.wu@intel.com> --- ShellPkg/DynamicCommand/TftpDynamicCommand/Tftp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ShellPkg/DynamicCommand/TftpDynamicCommand/Tftp.c b/ShellPkg/DynamicCommand/TftpDynamicCommand/Tftp.c index c66be6b9d9..d4391b9f33 100644 --- a/ShellPkg/DynamicCommand/TftpDynamicCommand/Tftp.c +++ b/ShellPkg/DynamicCommand/TftpDynamicCommand/Tftp.c @@ -934,10 +934,12 @@ DownloadFile ( DOWNLOAD_CONTEXT *TftpContext; EFI_MTFTP4_TOKEN Mtftp4Token; UINT8 BlksizeBuf[10]; UINT8 WindowsizeBuf[10]; + ZeroMem (&Mtftp4Token, sizeof (EFI_MTFTP4_TOKEN)); + // Downloaded file can be large. BS.AllocatePages() is more faster // than AllocatePool() and avoid fragmentation. // The downloaded file could be an EFI application. Marking the // allocated page as EfiBootServicesCode would allow to execute a // potential downloaded EFI application. @@ -959,11 +961,10 @@ DownloadFile ( } TftpContext->FileSize = FileSize; TftpContext->DownloadedNbOfBytes = 0; TftpContext->LastReportedNbOfBytes = 0; - ZeroMem (&Mtftp4Token, sizeof (EFI_MTFTP4_TOKEN)); Mtftp4Token.Filename = (UINT8*)AsciiFilePath; Mtftp4Token.BufferSize = FileSize; Mtftp4Token.Buffer = Buffer; Mtftp4Token.CheckPacket = CheckPacket; Mtftp4Token.Context = (VOID*)TftpContext; -- 2.17.1.windows.2 ^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Patch] ShellPkg/TftpDynamicCommand: Fix the potentially uninitialized local variable used. 2018-09-28 2:30 ` Zeng, Star @ 2018-09-28 2:51 ` Wu, Jiaxin 0 siblings, 0 replies; 3+ messages in thread From: Wu, Jiaxin @ 2018-09-28 2:51 UTC (permalink / raw) To: Zeng, Star, edk2-devel@lists.01.org; +Cc: Ye, Ting, Fu, Siyuan, Carsey, Jaben Thanks Star, I have committed the patch since it resolves the VS2012 build error. > -----Original Message----- > From: Zeng, Star > Sent: Friday, September 28, 2018 10:31 AM > To: Wu, Jiaxin <jiaxin.wu@intel.com>; edk2-devel@lists.01.org > Cc: Ye, Ting <ting.ye@intel.com>; Fu, Siyuan <siyuan.fu@intel.com>; Carsey, > Jaben <jaben.carsey@intel.com>; Zeng, Star <star.zeng@intel.com> > Subject: RE: [Patch] ShellPkg/TftpDynamicCommand: Fix the potentially > uninitialized local variable used. > > Reviewed-by: Star Zeng <star.zeng@intel.com> > > -----Original Message----- > From: Wu, Jiaxin > Sent: Thursday, September 27, 2018 10:42 PM > To: edk2-devel@lists.01.org > Cc: Ye, Ting <ting.ye@intel.com>; Fu, Siyuan <siyuan.fu@intel.com>; Carsey, > Jaben <jaben.carsey@intel.com>; Zeng, Star <star.zeng@intel.com>; Wu, > Jiaxin <jiaxin.wu@intel.com> > Subject: [Patch] ShellPkg/TftpDynamicCommand: Fix the potentially > uninitialized local variable used. > > Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1217 > > Local variable 'Mtftp4Token' might be uninitialized when error happen. This > patch is to resolve the issue. > > Cc: Ye Ting <ting.ye@intel.com> > Cc: Fu Siyuan <siyuan.fu@intel.com> > Cc: Carsey Jaben <jaben.carsey@intel.com> > Cc: Zeng Star <star.zeng@intel.com> > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Wu Jiaxin <jiaxin.wu@intel.com> > --- > ShellPkg/DynamicCommand/TftpDynamicCommand/Tftp.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/ShellPkg/DynamicCommand/TftpDynamicCommand/Tftp.c > b/ShellPkg/DynamicCommand/TftpDynamicCommand/Tftp.c > index c66be6b9d9..d4391b9f33 100644 > --- a/ShellPkg/DynamicCommand/TftpDynamicCommand/Tftp.c > +++ b/ShellPkg/DynamicCommand/TftpDynamicCommand/Tftp.c > @@ -934,10 +934,12 @@ DownloadFile ( > DOWNLOAD_CONTEXT *TftpContext; > EFI_MTFTP4_TOKEN Mtftp4Token; > UINT8 BlksizeBuf[10]; > UINT8 WindowsizeBuf[10]; > > + ZeroMem (&Mtftp4Token, sizeof (EFI_MTFTP4_TOKEN)); > + > // Downloaded file can be large. BS.AllocatePages() is more faster > // than AllocatePool() and avoid fragmentation. > // The downloaded file could be an EFI application. Marking the > // allocated page as EfiBootServicesCode would allow to execute a > // potential downloaded EFI application. > @@ -959,11 +961,10 @@ DownloadFile ( > } > TftpContext->FileSize = FileSize; > TftpContext->DownloadedNbOfBytes = 0; > TftpContext->LastReportedNbOfBytes = 0; > > - ZeroMem (&Mtftp4Token, sizeof (EFI_MTFTP4_TOKEN)); > Mtftp4Token.Filename = (UINT8*)AsciiFilePath; > Mtftp4Token.BufferSize = FileSize; > Mtftp4Token.Buffer = Buffer; > Mtftp4Token.CheckPacket = CheckPacket; > Mtftp4Token.Context = (VOID*)TftpContext; > -- > 2.17.1.windows.2 ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-09-28 2:51 UTC | newest] Thread overview: 3+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2018-09-27 14:42 [Patch] ShellPkg/TftpDynamicCommand: Fix the potentially uninitialized local variable used Jiaxin Wu 2018-09-28 2:30 ` Zeng, Star 2018-09-28 2:51 ` Wu, Jiaxin
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox