[edk2-devel] [PATCH] RedfishPkg/JsonLib: Fix JsonLib build failure

Nickle Wang via groups.io posted 1 patch 1 year, 6 months ago
Failed in applying to current master (apply log)
RedfishPkg/Library/JsonLib/JsonLib.c | 2 ++
1 file changed, 2 insertions(+)
[edk2-devel] [PATCH] RedfishPkg/JsonLib: Fix JsonLib build failure
Posted by Nickle Wang via groups.io 1 year, 6 months ago
VS2019 reports build failure: "warning C4701: potentially uninitialized
local variable 'Ucs2Str' used". Initial Ucs2Str to NULL at the beginning
of function.

Cc: Abner Chang <abner.chang@amd.com>
Cc: Nick Ramirez <nramirez@nvidia.com>
Signed-off-by: Nickle Wang <nicklew@nvidia.com>
---
 RedfishPkg/Library/JsonLib/JsonLib.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/RedfishPkg/Library/JsonLib/JsonLib.c b/RedfishPkg/Library/JsonLib/JsonLib.c
index 33d5eaef79..88b89bf6f8 100644
--- a/RedfishPkg/Library/JsonLib/JsonLib.c
+++ b/RedfishPkg/Library/JsonLib/JsonLib.c
@@ -6,6 +6,7 @@
 
   Copyright (c) 2018 - 2019, Intel Corporation. All rights reserved.<BR>
  (C) Copyright 2021 Hewlett Packard Enterprise Development LP<BR>
+ Copyright (c) 2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
 
     SPDX-License-Identifier: BSD-2-Clause-Patent
 **/
@@ -566,6 +567,7 @@ JsonValueGetUnicodeString (
   CONST CHAR8    *Utf8Str;
   CHAR16         *Ucs2Str;
 
+  Ucs2Str = NULL;
   Utf8Str = json_string_value ((json_t *) Json);
   if (Utf8Str == NULL) {
     return NULL;
-- 
2.37.3.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#94074): https://edk2.groups.io/g/devel/message/94074
Mute This Topic: https://groups.io/mt/93825141/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-
Re: [edk2-devel] [PATCH] RedfishPkg/JsonLib: Fix JsonLib build failure
Posted by Chang, Abner via groups.io 1 year, 6 months ago
[AMD Official Use Only - General]

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

> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Nickle
> Wang via groups.io
> Sent: Wednesday, September 21, 2022 8:43 PM
> To: devel@edk2.groups.io
> Cc: Chang, Abner <Abner.Chang@amd.com>; Nick Ramirez
> <nramirez@nvidia.com>
> Subject: [edk2-devel] [PATCH] RedfishPkg/JsonLib: Fix JsonLib build failure
> 
> Caution: This message originated from an External Source. Use proper
> caution when opening attachments, clicking links, or responding.
> 
> 
> VS2019 reports build failure: "warning C4701: potentially uninitialized local
> variable 'Ucs2Str' used". Initial Ucs2Str to NULL at the beginning of function.
> 
> Cc: Abner Chang <abner.chang@amd.com>
> Cc: Nick Ramirez <nramirez@nvidia.com>
> Signed-off-by: Nickle Wang <nicklew@nvidia.com>
> ---
>  RedfishPkg/Library/JsonLib/JsonLib.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/RedfishPkg/Library/JsonLib/JsonLib.c
> b/RedfishPkg/Library/JsonLib/JsonLib.c
> index 33d5eaef79..88b89bf6f8 100644
> --- a/RedfishPkg/Library/JsonLib/JsonLib.c
> +++ b/RedfishPkg/Library/JsonLib/JsonLib.c
> @@ -6,6 +6,7 @@
> 
>    Copyright (c) 2018 - 2019, Intel Corporation. All rights reserved.<BR>
>   (C) Copyright 2021 Hewlett Packard Enterprise Development LP<BR>
> + Copyright (c) 2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
> 
>      SPDX-License-Identifier: BSD-2-Clause-Patent  **/ @@ -566,6 +567,7 @@
> JsonValueGetUnicodeString (
>    CONST CHAR8    *Utf8Str;
>    CHAR16         *Ucs2Str;
> 
> +  Ucs2Str = NULL;
>    Utf8Str = json_string_value ((json_t *) Json);
>    if (Utf8Str == NULL) {
>      return NULL;
> --
> 2.37.3.windows.1
> 
> 
> 
> 
> 


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