Mike:
  DxeServicesLib wraps FV protocol services and simplifies Caller usage to get 
section data. Your usage is more align to FV protocol services. So, I suggest 
that you directly call FV protocol->ReadSection() to do it.

Thanks
Liming
-----Original Message-----
From: Mike Maslenkin [mailto:[email protected]] 
Sent: Friday, March 01, 2013 4:54 PM
To: [email protected]
Cc: Mike Maslenkin
Subject: [edk2] [RFC]]PATCH 0/2] MdePkg: Allow to read section data into a 
buffer allocated by caller

Dear  MdePkg Maintainer,

Currently MdePkg/DxeServicesLib does not allow to pass pointer to allocated 
buffer to read firmware section to. Is there any reason for that?
This prevents from concatenation of several sections within continuous memory 
area without additional copy operation.
Please find the attached patches that fix this issue.

Since InternalGetSectionFromFv() explicitly reinitializes to NULL pointer to 
buffer patch 1/2 introduced an additional parameter (BOOLEAN Allocate) that 
prevents from that.

A new function GetSectionFromFvToBuffer() was introduced in patch 2/2.
This function acts as GetSectionFromFv() but uses Allocate=FALSE flag passed to 
InternalGetSectionFromFv() so it does not reinitializes to NULL pointers to 
Buffer and Size explicitly.

An implementation of a new function was required because simple grepping showed 
that uninitialized pointers could be passed to GetSectionFromFv() according to 
its original description. Here is that calls:
./SecurityPkg/Tcg/TcgSmm/TcgSmm.c:303:  Status = GetSectionFromFv (
./OvmfPkg/Csm/CsmSupportLib/LegacyPlatform.c:795:        Status = 
GetSectionFromFv (
./MdeModulePkg/Core/PiSmmCore/PiSmmIpl.c:877:  Status = 
GetSectionFromAnyFvByFileType (
./MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/ScriptExecute.c:249: Status 
= GetSectionFromAnyFv  (
./EdkCompatibilityPkg/Compatibility/BootScriptSaveOnS3SaveStateThunk/ScriptSave.c:844:
    Status = GetSectionFromAnyFv

Signed-off-by: Mike Maslenkin <[email protected]>


------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics Download AppDynamics Lite for free 
today:
http://p.sf.net/sfu/appdyn_d2d_feb
_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-devel

------------------------------------------------------------------------------
Symantec Endpoint Protection 12 positioned as A LEADER in The Forrester  
Wave(TM): Endpoint Security, Q1 2013 and "remains a good choice" in the  
endpoint security space. For insight on selecting the right partner to 
tackle endpoint security challenges, access the full report. 
http://p.sf.net/sfu/symantec-dev2dev
_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-devel

Reply via email to