[edk2-devel] [PATCH 02/14] DynamicTablesPkg: Add PrintString to CmObjParser

PierreGondois posted 14 patches 3 years, 4 months ago
[edk2-devel] [PATCH 02/14] DynamicTablesPkg: Add PrintString to CmObjParser
Posted by PierreGondois 3 years, 4 months ago
From: Pierre Gondois <pierre.gondois@arm.com>

Add a PrintString to print strings in the CmObjParser.
String must be NULL terminated and no buffer overrun check
is done by this function.

Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
---
 .../ConfigurationManagerObjectParser.c        | 26 +++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/DynamicTablesPkg/Library/Common/TableHelperLib/ConfigurationManagerObjectParser.c b/DynamicTablesPkg/Library/Common/TableHelperLib/ConfigurationManagerObjectParser.c
index 13e6c0e321c4..b46f19693bb5 100644
--- a/DynamicTablesPkg/Library/Common/TableHelperLib/ConfigurationManagerObjectParser.c
+++ b/DynamicTablesPkg/Library/Common/TableHelperLib/ConfigurationManagerObjectParser.c
@@ -19,6 +19,14 @@ PrintOemId (
   UINT8        *Ptr
   );
 
+STATIC
+VOID
+EFIAPI
+PrintString (
+  CONST CHAR8  *Format,
+  UINT8        *Ptr
+  );
+
 /** A parser for EArmObjBootArchInfo.
 */
 STATIC CONST CM_OBJ_PARSER  CmArmBootArchInfoParser[] = {
@@ -646,6 +654,24 @@ PrintOemId (
     ));
 }
 
+/** Print string.
+
+  The string must be NULL terminated.
+
+  @param [in]  Format  Format to print the Ptr.
+  @param [in]  Ptr     Pointer to the string.
+**/
+STATIC
+VOID
+EFIAPI
+PrintString (
+  CONST CHAR8  *Format,
+  UINT8        *Ptr
+  )
+{
+  DEBUG ((DEBUG_ERROR, "%a", Ptr));
+}
+
 /** Print fields of the objects.
 
   @param [in]  Data           Pointer to the object to print.
-- 
2.25.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#94883): https://edk2.groups.io/g/devel/message/94883
Mute This Topic: https://groups.io/mt/94232521/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-
Re: [edk2-devel] [PATCH 02/14] DynamicTablesPkg: Add PrintString to CmObjParser
Posted by Sami Mujawar 3 years, 3 months ago
Hi Pierre,

Thank you for this patch.

Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>

Regards,

Sami Mujawar

On 10/10/2022 10:20 am, Pierre.Gondois@arm.com wrote:
> From: Pierre Gondois <pierre.gondois@arm.com>
>
> Add a PrintString to print strings in the CmObjParser.
> String must be NULL terminated and no buffer overrun check
> is done by this function.
>
> Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
> ---
>   .../ConfigurationManagerObjectParser.c        | 26 +++++++++++++++++++
>   1 file changed, 26 insertions(+)
>
> diff --git a/DynamicTablesPkg/Library/Common/TableHelperLib/ConfigurationManagerObjectParser.c b/DynamicTablesPkg/Library/Common/TableHelperLib/ConfigurationManagerObjectParser.c
> index 13e6c0e321c4..b46f19693bb5 100644
> --- a/DynamicTablesPkg/Library/Common/TableHelperLib/ConfigurationManagerObjectParser.c
> +++ b/DynamicTablesPkg/Library/Common/TableHelperLib/ConfigurationManagerObjectParser.c
> @@ -19,6 +19,14 @@ PrintOemId (
>     UINT8        *Ptr
>     );
>   
> +STATIC
> +VOID
> +EFIAPI
> +PrintString (
> +  CONST CHAR8  *Format,
> +  UINT8        *Ptr
> +  );
> +
>   /** A parser for EArmObjBootArchInfo.
>   */
>   STATIC CONST CM_OBJ_PARSER  CmArmBootArchInfoParser[] = {
> @@ -646,6 +654,24 @@ PrintOemId (
>       ));
>   }
>   
> +/** Print string.
> +
> +  The string must be NULL terminated.
> +
> +  @param [in]  Format  Format to print the Ptr.
> +  @param [in]  Ptr     Pointer to the string.
> +**/
> +STATIC
> +VOID
> +EFIAPI
> +PrintString (
> +  CONST CHAR8  *Format,
> +  UINT8        *Ptr
> +  )
> +{
> +  DEBUG ((DEBUG_ERROR, "%a", Ptr));
> +}
> +
>   /** Print fields of the objects.
>   
>     @param [in]  Data           Pointer to the object to print.


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#95601): https://edk2.groups.io/g/devel/message/95601
Mute This Topic: https://groups.io/mt/94232521/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-