From: "Chang, Abner via groups.io" <abner.chang=amd.com@groups.io>
To: Nickle Wang <nicklew@nvidia.com>,
"devel@edk2.groups.io" <devel@edk2.groups.io>
Cc: Igor Kulchytskyy <igork@ami.com>, Nick Ramirez <nramirez@nvidia.com>
Subject: Re: [edk2-devel] [edk2-redfish-client][PATCH] RedfishClientPkg/ConverterLib: check JSON value type
Date: Wed, 28 Feb 2024 01:44:10 +0000 [thread overview]
Message-ID: <LV8PR12MB9452DEB3266ED6002C708A34EA582@LV8PR12MB9452.namprd12.prod.outlook.com> (raw)
In-Reply-To: <20240227125247.6934-1-nicklew@nvidia.com>
[AMD Official Use Only - General]
Hi Nickle,
As this change is in the autogenerate source files. We have to update the script here: https://github.com/DMTF/Redfish-Schema-C-Struct-Generator
Not sure if you have access to this repo, however I am pleased inviting you to update the script on DMTF Github.
We will not merging this change on edk2-redfish-client repo.
Thanks
Abner
> -----Original Message-----
> From: Nickle Wang <nicklew@nvidia.com>
> Sent: Tuesday, February 27, 2024 8:53 PM
> To: devel@edk2.groups.io
> Cc: Chang, Abner <Abner.Chang@amd.com>; Igor Kulchytskyy
> <igork@ami.com>; Nick Ramirez <nramirez@nvidia.com>
> Subject: [edk2-redfish-client][PATCH] RedfishClientPkg/ConverterLib: check
> JSON value type
>
> Caution: This message originated from an External Source. Use proper caution
> when opening attachments, clicking links, or responding.
>
>
> Check and see if JSON object type is desired type before
> getting its value. According to the Redfish schema, attribute
> value can be null value. Add this error handling to avoid
> system assertion while getting attribute value.
>
> Signed-off-by: Nickle Wang <nicklew@nvidia.com>
> Cc: Abner Chang <abner.chang@amd.com>
> Cc: Igor Kulchytskyy <igork@ami.com>
> Cc: Nick Ramirez <nramirez@nvidia.com>
> ---
> RedfishClientPkg/ConverterLib/src/RedfishCsCommon.c | 10 ++++++++++
> 1 file changed, 10 insertions(+)
>
> diff --git a/RedfishClientPkg/ConverterLib/src/RedfishCsCommon.c
> b/RedfishClientPkg/ConverterLib/src/RedfishCsCommon.c
> index 250ef75e4..7ee3c86e1 100644
> --- a/RedfishClientPkg/ConverterLib/src/RedfishCsCommon.c
> +++ b/RedfishClientPkg/ConverterLib/src/RedfishCsCommon.c
> @@ -1,5 +1,7 @@
> /** @file
>
> + Copyright (c) 2024, NVIDIA CORPORATION & AFFILIATES. All rights
> reserved.
> +
> Copyright Notice:
> Copyright 2019-2024 Distributed Management Task Force, Inc. All rights
> reserved.
> License: BSD 3-Clause License. For full text see link:
> https://github.com/DMTF/Redfish-JSON-C-Struct-
> Converter/blob/master/LICENSE.md
> @@ -829,6 +831,10 @@ GetRedfishPropertyStr (
> return RedfishCS_status_not_found;
> }
>
> + if (!json_is_string (TempJsonObj)) {
> + return RedfishCS_status_not_found;
> + }
> +
> Status = allocateDuplicateStr (Cs, (char *)json_string_value (TempJsonObj),
> (void **)DstBuffer);
> return Status;
> }
> @@ -914,6 +920,10 @@ GetRedfishPropertyInt64 (
> return Status;
> }
>
> + if (!json_is_integer (TempJsonObj)) {
> + return RedfishCS_status_not_found;
> + }
> +
> **Dst = (RedfishCS_int64)json_integer_value (TempJsonObj);
> return RedfishCS_status_success;
> }
> --
> 2.34.1
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#116070): https://edk2.groups.io/g/devel/message/116070
Mute This Topic: https://groups.io/mt/104601599/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-
prev parent reply other threads:[~2024-02-28 1:44 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-27 12:52 [edk2-devel] [edk2-redfish-client][PATCH] RedfishClientPkg/ConverterLib: check JSON value type Nickle Wang via groups.io
2024-02-28 1:44 ` Chang, Abner via groups.io [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=LV8PR12MB9452DEB3266ED6002C708A34EA582@LV8PR12MB9452.namprd12.prod.outlook.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox