From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=104.47.0.87; helo=eur01-he1-obe.outbound.protection.outlook.com; envelope-from=udit.kumar@nxp.com; receiver=edk2-devel@lists.01.org Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-he1eur01on0087.outbound.protection.outlook.com [104.47.0.87]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 41F932034BBEA for ; Wed, 8 Nov 2017 20:39:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=WqT8zhz4VIQlO4TXRugLdHlHjfr0k2fYrGG8DSQ8OgE=; b=lnRqXsVMQFzW/TZ3MHxHxzC0PwAteHyqn/P13Llk96QlzDog7/vmE3e0PABZoMfV+H93+IrcD+VUTXW4B3pkGIDlKlLW3IWP0PIibKvvL77vgc3ogYGeUX1UPhRVWn0zn/jwvtvvssrQaNDKvwxrDwt1Jy+4NullBFXr3nB+rR8= Received: from AM6PR0402MB3334.eurprd04.prod.outlook.com (52.133.18.151) by AM3PR04MB291.eurprd04.prod.outlook.com (10.242.113.150) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.197.13; Thu, 9 Nov 2017 04:43:24 +0000 Received: from AM6PR0402MB3334.eurprd04.prod.outlook.com ([fe80::7cbb:e077:2ee1:20f0]) by AM6PR0402MB3334.eurprd04.prod.outlook.com ([fe80::7cbb:e077:2ee1:20f0%13]) with mapi id 15.20.0197.020; Thu, 9 Nov 2017 04:43:23 +0000 From: Udit Kumar To: Leif Lindholm CC: Vabhav Sharma , "edk2-devel@lists.01.org" , "ruiyu.ni@intel.com" , "jaben.carsey@intel.com" , "ard.biesheuvel@linaro.org" , "siyuan.fu@intel.com" , "ting.ye@intel.com" Thread-Topic: [PATCH] Tftp assert fix for openfile failure case Thread-Index: AQHTVH7+4kDHbRbEhEawzI/JXsGRxKMJOhCAgAC5yNCAAK3sgIAA3VXw Date: Thu, 9 Nov 2017 04:43:23 +0000 Message-ID: References: <1509719192-16582-1-git-send-email-vabhav.sharma@nxp.com> <20171107175458.f4pgne4rkri7lzch@bivouac.eciton.net> <20171108152225.gy6te7rcroqqjr3j@bivouac.eciton.net> In-Reply-To: <20171108152225.gy6te7rcroqqjr3j@bivouac.eciton.net> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=udit.kumar@nxp.com; x-originating-ip: [192.88.169.1] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; AM3PR04MB291; 6:6aknSA11tE75lqy70ZS2IvsjcqcgTBsUDsVVx8w5+i5s+k1qxGYUcf6BAm8gT+3L3QbFDUI9TxQB9nvT9kRX9uyU0D8myv7vxONz4hheFoscUiVbhnMjgOfNTNf5S3iP2KjfnN2NLxJUat+vaaQTeCZC/UYnppKlwQF43w/GKMag9vZWRePM2dahS36LENisx/AGubK/UXiojbFeG4Eb0UesxmEiEv0IQfu9gFeyi4huw3L4dtoajORT/h5J6uROmeqiVKnySWChxTVme12sPFr2JKI7dh69epdTnCAIATSeJe7UYM46leq6XIOxxNmSmgshou21uK3sFylpM8asvLZFW/s2ZEljTAtdZormQWg=; 5:6wnjATrriv3k2i6z6/MC0N8Qi1E8N7zs1z6mZ9NC5Ltxn+HWTNKK9/u7HKoMOBKxUoVL1iIf4Ic+1pTmZHu6GV1IpAZrkeXDiQzb4zmLEkW5WGnIBwJuD+H4nQmWwV1+lBFwa7dSt/lpybe1nGGBfCf59G0ArVIAYf1lN89LT8I=; 24:vGYL8wcnJ3lIUxB4yW8ZxxcFOUKMRCFLQk6QVphqnSCecbSSkIq1mISX1XuiW0qluFKVa44tQ9x3rxl8/vPgZ81l7RFjWa+JrdgJIoNDrL0=; 7:bPGuXhnGGKEWsB8koCbQYGMlmtTtHOwEbYih2EWUGqpFWePsuA03KltwF0nk9YYIvjZRJMOYAOJiE/rBGKaMlw8fFjC2xbY7nry5ydITlt8OhorXKPKjyjubTaRfIodf6UlXx9eNzKTqKMwB4DfYF86W6q0+TfSujfYmXjWflZKXqisJlacmsiSJKAfgwe+zAmf501C90hn0YVfdhGkiNuYP+sdwWqCT5W/EE/dhGYmgQMKUcPzeU+7itrOOlPl8 x-ms-exchange-antispam-srfa-diagnostics: SSOS;SSOR; x-forefront-antispam-report: SFV:SKI; SCL:-1; SFV:NSPM; SFS:(10009020)(6009001)(346002)(376002)(39860400002)(24454002)(13464003)(189002)(199003)(478600001)(99286004)(6506006)(93886005)(4326008)(316002)(5660300001)(66066001)(54906003)(86362001)(97736004)(3280700002)(53546010)(229853002)(3660700001)(305945005)(8676002)(5250100002)(54356999)(76176999)(2900100001)(101416001)(6436002)(7696004)(68736007)(6116002)(6246003)(105586002)(55016002)(2950100002)(33656002)(74316002)(3846002)(50986999)(2906002)(8936002)(7736002)(53936002)(25786009)(102836003)(9686003)(189998001)(6916009)(106356001)(14454004)(81156014)(81166006); DIR:OUT; SFP:1101; SCL:1; SRVR:AM3PR04MB291; H:AM6PR0402MB3334.eurprd04.prod.outlook.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; x-ms-office365-filtering-correlation-id: 2753ebbf-28be-4e15-968e-08d5272c6920 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(48565401081)(2017052603199); SRVR:AM3PR04MB291; x-ms-traffictypediagnostic: AM3PR04MB291: x-exchange-antispam-report-test: UriScan:(185117386973197)(162533806227266)(228905959029699); x-microsoft-antispam-prvs: x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(2401047)(5005006)(8121501046)(10201501046)(3002001)(93006095)(93001095)(3231021)(100000703101)(100105400095)(6055026)(6041248)(20161123564025)(20161123562025)(20161123555025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123558100)(20161123560025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:AM3PR04MB291; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:AM3PR04MB291; x-forefront-prvs: 0486A0CB86 received-spf: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2753ebbf-28be-4e15-968e-08d5272c6920 X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Nov 2017 04:43:23.7330 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM3PR04MB291 Subject: Re: [PATCH] Tftp assert fix for openfile failure case X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Nov 2017 04:39:27 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable > -----Original Message----- > From: Leif Lindholm [mailto:leif.lindholm@linaro.org] > Sent: Wednesday, November 08, 2017 8:52 PM > To: Udit Kumar > Cc: Vabhav Sharma ; edk2-devel@lists.01.org; > ruiyu.ni@intel.com; jaben.carsey@intel.com; ard.biesheuvel@linaro.org; > siyuan.fu@intel.com; ting.ye@intel.com > Subject: Re: [PATCH] Tftp assert fix for openfile failure case >=20 > On Wed, Nov 08, 2017 at 05:15:49AM +0000, Udit Kumar wrote: > > > > diff --git a/ShellPkg/Library/UefiShellTftpCommandLib/Tftp.c > > > > b/ShellPkg/Library/UefiShellTftpCommandLib/Tftp.c > > > > index fbde3bf..6425fc5 100755 > > > > --- a/ShellPkg/Library/UefiShellTftpCommandLib/Tftp.c > > > > +++ b/ShellPkg/Library/UefiShellTftpCommandLib/Tftp.c > > > > @@ -509,6 +509,7 @@ ShellCommandRunTftp ( > > > > ); > > > > goto NextHandle; > > > > > > Wow, a goto in a foor loop in a 320-line function. > > > What could possibly go wrong? > > > > Instead of being on some volume, if you are on Shell. > > Then file open will fail. >=20 > Sure. The above was a snarky comment on the state of the existing code. >=20 > > > > } > > > > + DataSize =3D FileSize; > > > > > > > > Status =3D DownloadFile (Mtftp4, RemoteFilePath, > > > > AsciiRemoteFilePath, > > > FileSize, BlockSize, &Data); > > > > if (EFI_ERROR (Status)) { > > > > @@ -539,7 +540,6 @@ ShellCommandRunTftp ( > > > > goto NextHandle; > > > > } > > > > > > > > - DataSize =3D FileSize; > > > > Status =3D ShellWriteFile (FileHandle, &FileSize, Data); > > > > if (!EFI_ERROR (Status)) { > > > > ShellStatus =3D SHELL_SUCCESS; > > > > -- > > > > 1.9.1 > > > > > > So, a wider question: > > > This shell command was introduced in the heyday of "let's > > > reimplement U-Boot in the EDK2 tree". Mainly, from my impression, it > > > seems to be used in order that people don't need to learn how boot > > > managers and device paths work. > > > > When you say about complete boot, then this may not be useful. > > > > > Am I being too harsh? > > > Are there practical uses for this? > > > > For doing some sort of unit testing of given interface. I found this > > useful. During development, this is useful to transfer generic file to > > development board. >=20 > OK, I can see how it could be useful. > My opposition is based on three things: > 1) people _are_ trying to use it for boot I agree with this, please see my previous comments,=20 ' When you say about complete boot, then this may not be useful.' > 2) not a command described by UEFI Shell spec, but I keep seeing > platforms including it even in RELEASE builds (most likely because 1) > 3) code quality/maintainability > > > If the code is to be kept, I think (from a quick glance) that I > > > would also like to see > > > *Data =3D NULL > > > in the error path of DownloadFile(). >=20 > OK, so we don't need to drop it right now, but what's your take on this > comment? I am fine, if you prefer to remove this then we will develop some test appl= ication for unit tests. In case, we need to maintain this piece of code then above needs to fix as = well.=20 =20 > / > Leif