From nobody Sat Feb 7 06:21:21 2026 Delivered-To: importer@patchew.org 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+47210+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1568386273; cv=none; d=zoho.com; s=zohoarc; b=e38ekTU7NYDhOHYMkFDJGK0J+7hxPh3UdWUQEI7rXhZqyJMq4e2FKI4ErZ/nCPjZF8CFWD1JV5sD4wa0i/d0TYLllZIMxJ0jXp8RbIKo2eI/H/wrnPz2SE3cGsemK0qMWgJCmLXJoUCmAw+deHQJgwQf+c+Mzwx1XTC1P3mItv4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1568386273; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To:ARC-Authentication-Results; bh=/DqPuuzwvO/VjOt67ia7N81X6LFOnJU4/iwohIWQKAI=; b=gPoNem5mCGFlzF/lwcaSzLgP/IzK3zDZ3MydKRVSz/PCLlLjkFiLhzG6xLkMPmAMggMvcuPuvjfv0VucoXqqWb9+l2RkXtYZVXnuFW880tldMYFqZitxnILyXtrB0WcP7EWp714D3UjgxDvYjF65xkVJmXQO9xbrS3r27oMtUr0= 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+47210+1787277+3901457@groups.io Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1568386273676188.93919432305518; Fri, 13 Sep 2019 07:51:13 -0700 (PDT) Return-Path: X-Received: from esa1.hc3370-68.iphmx.com (esa1.hc3370-68.iphmx.com [216.71.145.142]) by groups.io with SMTP; Fri, 13 Sep 2019 07:51:07 -0700 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+47210+1787277+3901457@groups.io; helo=web01.groups.io; Received-SPF: None (esa1.hc3370-68.iphmx.com: no sender authenticity information available from domain of anthony.perard@citrix.com) identity=pra; client-ip=162.221.158.21; receiver=esa1.hc3370-68.iphmx.com; envelope-from="anthony.perard@citrix.com"; x-sender="anthony.perard@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa1.hc3370-68.iphmx.com: domain of anthony.perard@citrix.com designates 162.221.158.21 as permitted sender) identity=mailfrom; client-ip=162.221.158.21; receiver=esa1.hc3370-68.iphmx.com; envelope-from="anthony.perard@citrix.com"; x-sender="anthony.perard@citrix.com"; x-conformance=sidf_compatible; x-record-type="v=spf1"; x-record-text="v=spf1 ip4:209.167.231.154 ip4:178.63.86.133 ip4:195.66.111.40/30 ip4:85.115.9.32/28 ip4:199.102.83.4 ip4:192.28.146.160 ip4:192.28.146.107 ip4:216.52.6.88 ip4:216.52.6.188 ip4:162.221.158.21 ip4:162.221.156.83 ~all" Received-SPF: None (esa1.hc3370-68.iphmx.com: no sender authenticity information available from domain of postmaster@mail.citrix.com) identity=helo; client-ip=162.221.158.21; receiver=esa1.hc3370-68.iphmx.com; envelope-from="anthony.perard@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: gA8UT5Ch/OGw3w+nTY3r6fio4u+BqYgSmlqKBXYupu999GYVV1zWWNJMsTOlVTQEyEErzLtXLU mLzxzSmCiCVgWqDW53Y+5bwfcIU0U1BqnnpheC4Wtt2VxFFnCTWffh7V5aBu5dxIeJFFsPJ27Z yYf4HTPPw1syuAYKXHZgzu8X6tmAR1FOwsdtomnRs0imfr+As4/BQ3io9d7+fBB8zNKurs0nav FTZoL0DNZfnYVjdaXjLfggT7kUxErUZCtbJKqf5lvKvGvzCiKL6wJO7HO+617LRq6MYVETNG+0 3mA= X-SBRS: 2.7 X-MesageID: 5595140 X-Ironport-Server: esa1.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.64,501,1559534400"; d="scan'208";a="5595140" From: "Anthony PERARD" To: CC: Ard Biesheuvel , Julien Grall , Jordan Justen , , Anthony Perard , Laszlo Ersek Subject: [edk2-devel] [PATCH 04/11] OvmfPkg/XenBusDxe: Avoid Allocate in XenStoreVSPrint Date: Fri, 13 Sep 2019 15:50:53 +0100 Message-ID: <20190913145100.303433-5-anthony.perard@citrix.com> In-Reply-To: <20190913145100.303433-1-anthony.perard@citrix.com> References: <20190913145100.303433-1-anthony.perard@citrix.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,anthony.perard@citrix.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=1568386273; bh=/DqPuuzwvO/VjOt67ia7N81X6LFOnJU4/iwohIWQKAI=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=j3nAwvjPmh2spcAfH4e+6SPqxDJ69KnraL0M0obo9xGONSVD8p5eAKaVA52IM9mHSUb KArQf3p1hgQuZeWDnoCeoRwe2amaCi48pwHCt+Flgpkm0aEv7mxERSXqdsCzfuO6ZtGRN S3uRq0JuAnrlfzY7799cbnmZkh+HrD8tU30= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" In order to be able to use XenStoreVSPrint during the ExitBootServices, we remove the allocation done by the function and use the stack instead. Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3D2190 Signed-off-by: Anthony PERARD Reviewed-by: Laszlo Ersek --- OvmfPkg/XenBusDxe/XenStore.c | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/OvmfPkg/XenBusDxe/XenStore.c b/OvmfPkg/XenBusDxe/XenStore.c index 5cc900190a..7b71dc156d 100644 --- a/OvmfPkg/XenBusDxe/XenStore.c +++ b/OvmfPkg/XenBusDxe/XenStore.c @@ -1259,20 +1259,17 @@ XenStoreVSPrint ( IN VA_LIST Marker ) { - CHAR8 *Buf; - XENSTORE_STATUS Status; - UINTN BufSize; - VA_LIST Marker2; + CHAR8 Buf[XENSTORE_PAYLOAD_MAX]; + UINTN Count; =20 - VA_COPY (Marker2, Marker); - BufSize =3D SPrintLengthAsciiFormat (FormatString, Marker2) + 1; - VA_END (Marker2); - Buf =3D AllocateZeroPool (BufSize); - AsciiVSPrint (Buf, BufSize, FormatString, Marker); - Status =3D XenStoreWrite (Transaction, DirectoryPath, Node, Buf); - FreePool (Buf); + Count =3D AsciiVSPrint (Buf, sizeof (Buf), FormatString, Marker); + ASSERT (Count > 0); + ASSERT (Count < sizeof (Buf)); + if ((Count =3D=3D 0) || (Count >=3D sizeof (Buf))) { + return XENSTORE_STATUS_EINVAL; + } =20 - return Status; + return XenStoreWrite (Transaction, DirectoryPath, Node, Buf); } =20 XENSTORE_STATUS --=20 Anthony PERARD -=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 (#47210): https://edk2.groups.io/g/devel/message/47210 Mute This Topic: https://groups.io/mt/34128011/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-