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=2190 Signed-off-by: Anthony PERARD <anthony.per...@citrix.com> --- 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; - VA_COPY (Marker2, Marker); - BufSize = SPrintLengthAsciiFormat (FormatString, Marker2) + 1; - VA_END (Marker2); - Buf = AllocateZeroPool (BufSize); - AsciiVSPrint (Buf, BufSize, FormatString, Marker); - Status = XenStoreWrite (Transaction, DirectoryPath, Node, Buf); - FreePool (Buf); + Count = AsciiVSPrint (Buf, sizeof (Buf), FormatString, Marker); + ASSERT (Count > 0); + ASSERT (Count < sizeof (Buf)); + if ((Count == 0) || (Count >= sizeof (Buf))) { + return XENSTORE_STATUS_EINVAL; + } - return Status; + return XenStoreWrite (Transaction, DirectoryPath, Node, Buf); } XENSTORE_STATUS -- Anthony PERARD -=-=-=-=-=-=-=-=-=-=-=- 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/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-