[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH 04/11] OvmfPkg/XenBusDxe: Avoid Allocate in XenStoreVSPrint
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.perard@xxxxxxxxxx> --- 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 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |