[edk2-devel] [PATCH 2/5] RedfishPkg: Prevent assertion of allocate zero length region

Nickle Wang via groups.io nicklew=nvidia.com at groups.io
Fri Apr 14 09:03:51 UTC 2023


Hi Minh,

> Prevent assertion of allocate zero length region

May I know where does zero length allocation happen? According to my understanding, setting the "SubnetAddrInfoIPv6Number" to zero here and it will be handled by below condition check:

https://github.com/tianocore/edk2/blob/55b67b6950e648338adfe8ec54aeb26ed89d2c97/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c#L1005

Then the code leaves function with EFI_NOT_FOUND error. 

Thanks,
Nickle

> -----Original Message-----
> From: Minh Nguyen <minhnguyen at os.amperecomputing.com>
> Sent: Friday, April 14, 2023 4:19 PM
> To: devel at edk2.groups.io
> Cc: patches at amperecomputing.com; abner.chang at amd.com; Nickle Wang
> <nicklew at nvidia.com>; igork at ami.com; nhi at os.amperecomputing.com;
> tinhnguyen at os.amperecomputing.com; Vu Nguyen
> <vunguyen at os.amperecomputing.com>; Minh Nguyen
> <minhnguyen at os.amperecomputing.com>
> Subject: [PATCH 2/5] RedfishPkg: Prevent assertion of allocate zero length
> region
> 
> External email: Use caution opening links or attachments
> 
> 
> From: Vu Nguyen <vunguyen at os.amperecomputing.com>
> 
> This change also fix miscellaneous errors on condition checking and debug
> argument missing.
> 
> Signed-off-by: Minh Nguyen <minhnguyen at os.amperecomputing.com>
> ---
>  RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
> b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
> index 583c6f78e19c..29e7b0624ebf 100644
> --- a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
> +++ b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
> @@ -5,6 +5,7 @@
>    (C) Copyright 2021 Hewlett Packard Enterprise Development LP<BR>
>    Copyright (c) 2022, AMD Incorporated. All rights reserved.
>    Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
> +  Copyright (c) 2023, Ampere Computing LLC. All rights reserved.<BR>
> 
>    SPDX-License-Identifier: BSD-2-Clause-Patent
> 
> @@ -272,7 +273,7 @@ Tcp6GetSubnetInfo (
>    if (IpModedata.AddressCount == 0) {
>      DEBUG ((DEBUG_INFO, "%a: No IPv6 address configured.\n", __func__));
>      Instance->SubnetAddrInfoIPv6Number = 0;
> -    return EFI_SUCCESS;
> +    return EFI_NOT_FOUND;
>    }
> 
>    if (Instance->SubnetAddrInfoIPv6 != NULL) { @@ -926,7 +927,7 @@
> AddAndSignalNewRedfishService (
>      }
> 
>      Status = gBS->SignalEvent (Instance->DiscoverToken->Event);
> -    if (!EFI_ERROR (Status)) {
> +    if (EFI_ERROR (Status)) {
>        DEBUG ((DEBUG_ERROR, "%a:No event to signal!\n", __func__));
>      }
>    }
> --
> 2.39.0



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#102989): https://edk2.groups.io/g/devel/message/102989
Mute This Topic: https://groups.io/mt/98258415/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