From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=104.47.42.49; helo=nam03-by2-obe.outbound.protection.outlook.com; envelope-from=meenakshi.aggarwal@nxp.com; receiver=edk2-devel@lists.01.org Received: from NAM03-BY2-obe.outbound.protection.outlook.com (mail-by2nam03on0049.outbound.protection.outlook.com [104.47.42.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 9D87E21E1B752 for ; Mon, 25 Sep 2017 01:45:52 -0700 (PDT) Received: from CY4PR03CA0013.namprd03.prod.outlook.com (10.168.162.23) by CO2PR03MB2359.namprd03.prod.outlook.com (10.166.93.19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.77.7; Mon, 25 Sep 2017 08:49:02 +0000 Received: from BL2FFO11FD054.protection.gbl (2a01:111:f400:7c09::116) by CY4PR03CA0013.outlook.office365.com (2603:10b6:903:33::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.56.11 via Frontend Transport; Mon, 25 Sep 2017 08:49:02 +0000 Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=nxp.com; nxp.com; dkim=none (message not signed) header.d=none;nxp.com; dmarc=fail action=none header.from=nxp.com; Received-SPF: Fail (protection.outlook.com: domain of nxp.com does not designate 192.88.168.50 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.168.50; helo=tx30smr01.am.freescale.net; Received: from tx30smr01.am.freescale.net (192.88.168.50) by BL2FFO11FD054.mail.protection.outlook.com (10.173.161.182) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.35.14 via Frontend Transport; Mon, 25 Sep 2017 08:49:02 +0000 Received: from uefi-OptiPlex-790.ap.freescale.net (uefi-OptiPlex-790.ap.freescale.net [10.232.132.78]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id v8P8mwFs010321; Mon, 25 Sep 2017 01:48:59 -0700 From: Meenakshi Aggarwal To: , , CC: , , Meenakshi Aggarwal , Udit Kumar , Vabhav Sharma Date: Mon, 25 Sep 2017 20:07:29 +0530 Message-ID: <1506350249-28082-1-git-send-email-meenakshi.aggarwal@nxp.com> X-Mailer: git-send-email 1.9.1 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131508029424263592; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Forefront-Antispam-Report: CIP:192.88.168.50; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(336005)(376002)(346002)(39380400002)(39860400002)(2980300002)(1110001)(1109001)(339900001)(189002)(199003)(356003)(53936002)(5660300001)(6666003)(189998001)(36756003)(106466001)(50986999)(105606002)(48376002)(16586007)(4326008)(2906002)(97736004)(8676002)(81156014)(50466002)(316002)(498600001)(8936002)(33646002)(77096006)(50226002)(110136005)(86362001)(85426001)(305945005)(2201001)(81166006)(47776003)(5003940100001)(8656003)(104016004)(54906003)(68736007); DIR:OUT; SFP:1101; SCL:1; SRVR:CO2PR03MB2359; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BL2FFO11FD054; 1:nz9qMRn8bCmOlgsjM+F7Sv5wdpMttMphoD2o+ZJ2RGwUtVhhyiuE6/Kfum5eddVvTkXVYaqstzXkTqsOksHTFbDhzE1bn8Jgdb26khn6oNJWqErzGKpSiORustMyJFfa MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a18c858b-7209-4845-1eea-08d503f24564 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(2017052603199)(201703131430075)(201703131517081); SRVR:CO2PR03MB2359; X-Microsoft-Ex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HGOx3zAbi9WCkO0KaOFjjDyFM8NW+qPkpXkP6ACvmvh8LUV2/xbm9dExLJNwSvr70F4HmnsWKfwOe+Vm7Jwp3DAMT8RRLnLqWWpjiathg7f+G5/mjcsr51Lz2ZymFoWZNKs1cMOFbYED2wVuO91UG2hlSs/NY+/vARr7jUZl99pSvKtzw1Bra4ydyo9LwJKKXJvppGDUTc4vz2yP/SN8VBHIRqgsMVEw3GLQ8Dareet6KMXSbn1D6twwnSEnFqupQ+A0TUse37T/7QHLPz/c= X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6095135)(2401047)(5005006)(8121501046)(93006095)(93001095)(100000703101)(100105400095)(10201501046)(3002001)(6055026)(6096035)(20161123565025)(20161123556025)(201703131430075)(201703131448075)(201703131433075)(201703161259150)(201703151042153)(20161123561025)(20161123559100)(20161123563025)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:CO2PR03MB2359; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(400006)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:CO2PR03MB2359; X-Forefront-PRVS: 04410E544A X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CO2PR03MB2359; 23:RvPOFoyxwt0P/alyYTWbB9tY/o8P9zK9oSijTV+Bi?= =?us-ascii?Q?QyOZrxwd7I6nLqrk11dX6ohK1M3LBEEQDQJfZ/ArhbOqFIog8bjAYx8ekIx9?= =?us-ascii?Q?IRVCe/92/SRhCCPdC3v09L488oHZ6TQFxlBjTZ6sUZzXVRg9wPlyQerTXnJQ?= =?us-ascii?Q?pb7ZckMWoyfsqKD1dGxQV34xNJ/03B2xagBNM/4ESs1WHZN5M67FuK7PYpt8?= =?us-ascii?Q?VMRS68tSvY7Uh8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M6+V6?= =?us-ascii?Q?RpwAb0Nk+k=3D?= X-Microsoft-Exchange-Diagnostics: 1; CO2PR03MB2359; 6:ZtqPfMfZ/BdeozXor38dOV99f7e+rUcQq9TrJ7ii+EXzeuPX58JMpfX+5hBdNPtD2htLx1LOFoo825ibd187q6bhFARBr0qxRqZM1GqPY6doz5zdyV3QxTmDOsFS24WYlCxmisAF2j19dQ57PPwpdg1BTBWI271Xj1J7/UTckXVv9A6hgfJFjiKn2GsELDOcRcjzQ9Kbv9jubP9I+1VSP3wCmBluEE2AOgjGhCawoyPMdKPf9jPGmkyyiNvMPCnfMC6bHWTUWrVbqnZuwBzfBWMLi4tcFEYK5y1zRus6Rb5qVqUxpUyCKnuMgah/2ZTqfJCwakWyzopUsbTNP1/qvg==; 5:gNXkd4prrDwpa9FDkr71obTt2o4Iy3SfKCdpYNiDel3pPzLwUotF9nLuoiw/RdNMnGDdNd9c48WPfKWXRPD7hboj80CnfyWlARBqDMliDaHZUakiszWhbbI3NOPtZYG9VSKEG8dDQvdWSwjUt8bXzw==; 24:RlrKb6iVNe6NZm9efHx23a2eQSDew1okA1xvKPv9tvU895yJvd25rDb9mWKONWXMKrbw1rtwDMTA4z458pY8ZAgRQ2fwIcB6NyBychMzEd4=; 7:RlA9iG+dwBr4TOXKJI/jf/l+5FRdVC4/W8xTyd6d2v4ZQGnCXZXxhFDxGhupyei+ZyiB7oajdi+2Ii9zTMIBRYCaPfV70+8BROhUyS6CLg3tA8v6IfHUge3FheRvepP48Yf6R16v1cN0VRSQxReKHt6ArnvkcT19Pdl2MZx6gvlKDJIyFDvbG5L2cSzGxX4Fiihy+Gmyw7Er+1rOvEwZq1I/lv7AKQ9VrEHnsDfSxyw= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Sep 2017 08:49:02.2391 (UTC) X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e; Ip=[192.88.168.50]; Helo=[tx30smr01.am.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO2PR03MB2359 Subject: [PATCH] TFTP : tftp fix for full volume 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: Mon, 25 Sep 2017 08:45:52 -0000 Content-Type: text/plain 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 Signed-off-by: Meenakshi Aggarwal Signed-off-by: Vabhav Sharma --- ShellPkg/Library/UefiShellTftpCommandLib/Tftp.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ShellPkg/Library/UefiShellTftpCommandLib/Tftp.c b/ShellPkg/Library/UefiShellTftpCommandLib/Tftp.c index 5c50797..fae8a69 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; @@ -537,6 +538,7 @@ ShellCommandRunTftp ( goto NextHandle; } + DataSize = FileSize; Status = ShellWriteFile (FileHandle, &FileSize, Data); if (!EFI_ERROR (Status)) { ShellStatus = SHELL_SUCCESS; @@ -551,7 +553,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