From nobody Fri Apr 26 05:11:07 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+42258+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+42258+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1560320053; cv=none; d=zoho.com; s=zohoarc; b=RtvclI8gr/B85WPAA3tjR0AJyUJqkMUAwR9ReQ/8yXdAjjfHZ5eplT7poms9/9EI3nKGJqC3brsTSGkbKZesV/vq/1g9PFk93Xtu+iTDW7gIrrk0ALHhslh+mP5s/jRDqTsDEcbY+kyVsVc3DrZci6QZvpCTkJvpjn4dRJt56WA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1560320053; h=Content-Transfer-Encoding:Cc:Date:From:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Sender:Subject:To:ARC-Authentication-Results; bh=eqL9Pd1AIjaSvZ/Vu1EMDkkTP5IuaPZ6AxEferwf1Bg=; b=fsUYdg11OU/2zEE7CvEAnbd1JaeUso23Zn6qwFqzO6/tagrL6vqGreRCVYimu/0cqyhbNZ+HQecB9r2mljb1fds8OVrtRS+p4NFgYv9q9KybuZm2Mk/Fv5SVqC4U5jk1IB8WEeEYShEngYfkBDJw9sgyVMtaSJhYO95Ot9cJpWI= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+42258+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1560320053971554.9482733685862; Tue, 11 Jun 2019 23:14:13 -0700 (PDT) Return-Path: X-Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by groups.io with SMTP; Tue, 11 Jun 2019 23:14:13 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 11 Jun 2019 23:14:12 -0700 X-ExtLoop1: 1 X-Received: from fieedk001.ccr.corp.intel.com ([10.239.33.119]) by fmsmga001.fm.intel.com with ESMTP; 11 Jun 2019 23:14:11 -0700 From: "Gao, Zhichao" To: devel@edk2.groups.io Cc: Bret Barkelew , Jaben Carsey , Ray Ni , Liming Gao , Sean Brogan , Michael Turner Subject: [edk2-devel] [PATCH] ShellPkg/UefiShellLib: Set input pointer parameter to null if failure Date: Wed, 12 Jun 2019 14:13:57 +0800 Message-Id: <20190612061357.15352-1-zhichao.gao@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,zhichao.gao@intel.com Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1560320053; bh=ruOtM9tp69MHx3s0rgEgAjcu9i7yxPc7hmEi4JyZHL0=; h=Cc:Date:From:Reply-To:Subject:To; b=iWoyGtfoxoGaW0k613jZ77a7rJOuK8JRfYcF32ab4pS2qX0zRBTTvuVZRbm+IYLnOI3 BGOatxdDs72j6H/KLepk09fFD0+KbnukR02+eRFuVM552QBeZ7zf/aITtvkBx5yQKKJcB DF7u55/LS+m5qGJLxFTVwTIewcSxEcvNquw= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" From: Bret Barkelew REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D1906 While failed to allocate memory to save the response, set the input/output parameter 'Response'(VOID **) to NULL to indicate the failure not only depend on the returned status. Cc: Jaben Carsey Cc: Ray Ni Cc: Liming Gao Cc: Sean Brogan Cc: Michael Turner Cc: Bret Barkelew Signed-off-by: Zhichao Gao --- ShellPkg/Library/UefiShellLib/UefiShellLib.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ShellPkg/Library/UefiShellLib/UefiShellLib.c b/ShellPkg/Librar= y/UefiShellLib/UefiShellLib.c index 430b20e127..5be530092e 100644 --- a/ShellPkg/Library/UefiShellLib/UefiShellLib.c +++ b/ShellPkg/Library/UefiShellLib/UefiShellLib.c @@ -3366,6 +3366,9 @@ ShellPromptForResponse ( if (Type !=3D ShellPromptResponseTypeFreeform) { Resp =3D (SHELL_PROMPT_RESPONSE*)AllocateZeroPool(sizeof(SHELL_PROMPT_= RESPONSE)); if (Resp =3D=3D NULL) { + if (Response !=3D NULL) { + *Response =3D NULL; + } return (EFI_OUT_OF_RESOURCES); } } @@ -3568,6 +3571,8 @@ ShellPromptForResponse ( *Response =3D Resp; } else if (Buffer !=3D NULL) { *Response =3D Buffer; + } else { + *Response =3D NULL; } } else { if (Resp !=3D NULL) { --=20 2.21.0.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#42258): https://edk2.groups.io/g/devel/message/42258 Mute This Topic: https://groups.io/mt/32038420/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-