From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=216.228.121.143; helo=hqemgate14.nvidia.com; envelope-from=jbrasen@nvidia.com; receiver=edk2-devel@lists.01.org Received: from hqemgate14.nvidia.com (hqemgate14.nvidia.com [216.228.121.143]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 7A33B2117D26C for ; Tue, 30 Oct 2018 14:31:27 -0700 (PDT) Received: from hqpgpgate102.nvidia.com (Not Verified[216.228.121.13]) by hqemgate14.nvidia.com (using TLS: TLSv1.2, DES-CBC3-SHA) id ; Tue, 30 Oct 2018 14:31:13 -0700 Received: from hqmail.nvidia.com ([172.20.161.6]) by hqpgpgate102.nvidia.com (PGP Universal service); Tue, 30 Oct 2018 14:31:26 -0700 X-PGP-Universal: processed; by hqpgpgate102.nvidia.com on Tue, 30 Oct 2018 14:31:26 -0700 Received: from HQMAIL110.nvidia.com (172.18.146.15) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Tue, 30 Oct 2018 21:31:26 +0000 Received: from HQMAIL105.nvidia.com (172.20.187.12) by hqmail110.nvidia.com (172.18.146.15) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Tue, 30 Oct 2018 21:31:26 +0000 Received: from hqnvemgw01.nvidia.com (172.20.150.20) by HQMAIL105.nvidia.com (172.20.187.12) with Microsoft SMTP Server (TLS) id 15.0.1395.4 via Frontend Transport; Tue, 30 Oct 2018 21:31:25 +0000 Received: from jbrasen-ux.nvidia.com (Not Verified[10.28.48.113]) by hqnvemgw01.nvidia.com with Trustwave SEG (v7, 5, 8, 10121) id ; Tue, 30 Oct 2018 14:31:25 -0700 From: Jeff Brasen To: CC: Jeff Brasen Date: Tue, 30 Oct 2018 15:30:58 -0600 Message-ID: X-Mailer: git-send-email 2.7.4 In-Reply-To: References: X-NVConfidentiality: public MIME-Version: 1.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1540935074; bh=HVL/9vbqDTLXBcy6DUgK6FmBqqBsShJrmkn4NoPK/3g=; h=X-PGP-Universal:From:To:CC:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:X-NVConfidentiality:MIME-Version: Content-Type; b=h4bf7b/HUYC61wphU/nbR1pWFe+JSACFZEsxNIYisIHDTbIQiC+iED8AU/Wot7KQq SBpu75y4GOY2KeXtX5XkxaCeYlabCtFD/E9FIEvvbC3rvsCh1YGUM1SS3hB4nXH2S+ tJ/U1l2gQH3c4xGggstuoJUctLgH7fnYTpP79hsoPCUm1YvQ5jYJcvyM4H7EYq8xM7 iNylPSNYHYbAbZIXkQOZjUjxBPLCV+GDdO7fVReFRyvsr0OeewfIA3EZLeo8OffLYv Z7WkUgeF/l62hhCLiDHIlAJTGkpTG3zPMkPldCAAmMM54bic1CJygdqPW6VudMfVpy LT3UexPGHngRA== Subject: [PATCH 1/2] EmbeddedPkg/PrePiMemoryAllocationLib: Added AllocateZeroPool() X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Oct 2018 21:31:27 -0000 Content-Type: text/plain This function is exposed by the MemoryAllocationLib header. An AllocateZeroPool() function has been added to fix modules depending on this library and this function. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jeff Brasen --- .../PrePiMemoryAllocationLib/MemoryAllocationLib.c | 32 ++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/EmbeddedPkg/Library/PrePiMemoryAllocationLib/MemoryAllocationLib.c b/EmbeddedPkg/Library/PrePiMemoryAllocationLib/MemoryAllocationLib.c index 0e75e23..f93f9cf 100644 --- a/EmbeddedPkg/Library/PrePiMemoryAllocationLib/MemoryAllocationLib.c +++ b/EmbeddedPkg/Library/PrePiMemoryAllocationLib/MemoryAllocationLib.c @@ -16,6 +16,7 @@ #include #include +#include #include #include @@ -195,6 +196,37 @@ AllocatePool ( } /** + Allocates and zeros a buffer of type EfiBootServicesData. + + Allocates the number bytes specified by AllocationSize of type EfiBootServicesData, clears the + buffer with zeros, and returns a pointer to the allocated buffer. If AllocationSize is 0, then a + valid buffer of 0 size is returned. If there is not enough memory remaining to satisfy the + request, then NULL is returned. + + @param AllocationSize The number of bytes to allocate and zero. + + @return A pointer to the allocated buffer or NULL if allocation fails. + +**/ +VOID * +EFIAPI +AllocateZeroPool ( + IN UINTN AllocationSize + ) +{ + VOID *Buffer; + + Buffer = AllocatePool (AllocationSize); + if (NULL == Buffer) { + return NULL; + } + + SetMem (Buffer, AllocationSize, 0); + + return Buffer; +} + +/** Frees a buffer that was previously allocated with one of the pool allocation functions in the Memory Allocation Library. -- 2.7.4