From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.20; helo=mga02.intel.com; envelope-from=jiaxin.wu@intel.com; receiver=edk2-devel@lists.01.org Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 6F94821159CBA for ; Thu, 27 Sep 2018 19:51:13 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 27 Sep 2018 19:51:13 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,313,1534834800"; d="scan'208";a="78115564" Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by orsmga006.jf.intel.com with ESMTP; 27 Sep 2018 19:51:05 -0700 Received: from FMSMSX110.amr.corp.intel.com (10.18.116.10) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.319.2; Thu, 27 Sep 2018 19:51:04 -0700 Received: from shsmsx101.ccr.corp.intel.com (10.239.4.153) by fmsmsx110.amr.corp.intel.com (10.18.116.10) with Microsoft SMTP Server (TLS) id 14.3.319.2; Thu, 27 Sep 2018 19:51:04 -0700 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.245]) by SHSMSX101.ccr.corp.intel.com ([169.254.1.220]) with mapi id 14.03.0319.002; Fri, 28 Sep 2018 10:51:01 +0800 From: "Wu, Jiaxin" To: "Zeng, Star" , "edk2-devel@lists.01.org" CC: "Ye, Ting" , "Fu, Siyuan" , "Carsey, Jaben" Thread-Topic: [Patch] ShellPkg/TftpDynamicCommand: Fix the potentially uninitialized local variable used. Thread-Index: AQHUVnCPd4sv7y74hku+CCa8ipgFwaUEc3UAgACLg1A= Date: Fri, 28 Sep 2018 02:51:01 +0000 Message-ID: <895558F6EA4E3B41AC93A00D163B7274164B42A2@SHSMSX103.ccr.corp.intel.com> References: <20180927144203.576-1-Jiaxin.wu@intel.com> <0C09AFA07DD0434D9E2A0C6AEB0483103BBF4697@shsmsx102.ccr.corp.intel.com> In-Reply-To: <0C09AFA07DD0434D9E2A0C6AEB0483103BBF4697@shsmsx102.ccr.corp.intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiNjA1Yjk1YzctODQyOC00YmUxLTk3MzktOGE1ZDJkMjFkZjAzIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiNGhHVWJwMnU2ZXA2ZVBqUlRsM2JFMXZYSUk1MHRvS1dSaFM2OU9sbVJnOVhcL2dtVXNaOFdxZHZuamV4Ym5zdXkifQ== x-ctpclassification: CTP_NT dlp-product: dlpe-windows dlp-version: 11.0.400.15 dlp-reaction: no-action x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [Patch] ShellPkg/TftpDynamicCommand: Fix the potentially uninitialized local variable used. X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Sep 2018 02:51:13 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Thanks Star, I have committed the patch since it resolves the VS2012 build = error. =20 > -----Original Message----- > From: Zeng, Star > Sent: Friday, September 28, 2018 10:31 AM > To: Wu, Jiaxin ; edk2-devel@lists.01.org > Cc: Ye, Ting ; Fu, Siyuan ; Carse= y, > Jaben ; Zeng, Star > Subject: RE: [Patch] ShellPkg/TftpDynamicCommand: Fix the potentially > uninitialized local variable used. >=20 > Reviewed-by: Star Zeng >=20 > -----Original Message----- > From: Wu, Jiaxin > Sent: Thursday, September 27, 2018 10:42 PM > To: edk2-devel@lists.01.org > Cc: Ye, Ting ; Fu, Siyuan ; Carse= y, > Jaben ; Zeng, Star ; Wu, > Jiaxin > Subject: [Patch] ShellPkg/TftpDynamicCommand: Fix the potentially > uninitialized local variable used. >=20 > Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3D1217 >=20 > Local variable 'Mtftp4Token' might be uninitialized when error happen. Th= is > patch is to resolve the issue. >=20 > Cc: Ye Ting > Cc: Fu Siyuan > Cc: Carsey Jaben > Cc: Zeng Star > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Wu Jiaxin > --- > ShellPkg/DynamicCommand/TftpDynamicCommand/Tftp.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) >=20 > 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]; >=20 > + 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 =3D FileSize; > TftpContext->DownloadedNbOfBytes =3D 0; > TftpContext->LastReportedNbOfBytes =3D 0; >=20 > - ZeroMem (&Mtftp4Token, sizeof (EFI_MTFTP4_TOKEN)); > Mtftp4Token.Filename =3D (UINT8*)AsciiFilePath; > Mtftp4Token.BufferSize =3D FileSize; > Mtftp4Token.Buffer =3D Buffer; > Mtftp4Token.CheckPacket =3D CheckPacket; > Mtftp4Token.Context =3D (VOID*)TftpContext; > -- > 2.17.1.windows.2