[edk2-devel] [edk2-redfish-client][PATCH v2 11/11] RedfishFeatureCoreDxe: add check for memory allocation failure

Chang, Abner via groups.io abner.chang=amd.com at groups.io
Fri Oct 27 02:35:07 UTC 2023


[AMD Official Use Only - General]

Reviewed-by: Abner Chang <abner.chang at amd.com>

> -----Original Message-----
> From: Mike Maslenkin <mike.maslenkin at gmail.com>
> Sent: Friday, October 27, 2023 7:54 AM
> To: devel at edk2.groups.io
> Cc: Chang, Abner <Abner.Chang at amd.com>; nicklew at nvidia.com;
> igork at ami.com; Mike Maslenkin <mike.maslenkin at gmail.com>
> Subject: [edk2-redfish-client][PATCH v2 11/11] RedfishFeatureCoreDxe: add
> check for memory allocation failure
>
> Caution: This message originated from an External Source. Use proper caution
> when opening attachments, clicking links, or responding.
>
>
> Signed-off-by: Mike Maslenkin <mike.maslenkin at gmail.com>
> ---
>  .../RedfishFeatureCoreDxe/RedfishFeatureCoreDxe.c           | 6 ++++++
>  1 file changed, 6 insertions(+)
>
> diff --git a/RedfishClientPkg/RedfishFeatureCoreDxe/RedfishFeatureCoreDxe.c
> b/RedfishClientPkg/RedfishFeatureCoreDxe/RedfishFeatureCoreDxe.c
> index f71b12e4b5e0..d9aa6e1a8145 100644
> --- a/RedfishClientPkg/RedfishFeatureCoreDxe/RedfishFeatureCoreDxe.c
> +++ b/RedfishClientPkg/RedfishFeatureCoreDxe/RedfishFeatureCoreDxe.c
> @@ -331,6 +331,12 @@ NewInternalInstance (
>    }
>
>
>
>    NewInternalData->NodeName = AllocateZeroPool (StrSize (NodeName));
>
> +  if (NewInternalData->NodeName == NULL) {
>
> +    DEBUG ((DEBUG_ERROR, "%a: No memory for NodeName\n", __func__));
>
> +    FreePool (NewInternalData);
>
> +    return EFI_OUT_OF_RESOURCES;
>
> +  }
>
> +
>
>    StrnCpyS (NewInternalData->NodeName, StrLen (NodeName) + 1, (CONST
> CHAR16 *)NodeName, StrLen (NodeName));
>
>    NewInternalData->SiblingList = NULL;
>
>    NewInternalData->ChildList   = NULL;
>
> --
> 2.32.0 (Apple Git-132)



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#110169): https://edk2.groups.io/g/devel/message/110169
Mute This Topic: https://groups.io/mt/102211780/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-




More information about the edk2-devel-archive mailing list