public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Mike Maslenkin" <mike.maslenkin@gmail.com>
To: devel@edk2.groups.io
Cc: abner.chang@amd.com, nicklew@nvidia.com, igork@ami.com,
	Mike Maslenkin <mike.maslenkin@gmail.com>
Subject: [edk2-devel] [edk2-redfish-client][PATCH 3/4] RedfishClientPkg: fix access to unitialized variable.
Date: Fri, 15 Dec 2023 03:03:59 +0300	[thread overview]
Message-ID: <20231215000400.5311-4-mike.maslenkin@gmail.com> (raw)
In-Reply-To: <20231215000400.5311-1-mike.maslenkin@gmail.com>

It is possible that at the time of accessing to AsciiLocation pointer
the memory is not allocated.

Also gcc version 4.8.5 20150623 (Red Hat 4.8.5-44) emits a warning for
this case:

RedfishFeatureUtilityLib.c:1889:37: error: 'AsciiLocation' may be used uninitialized in this function [-Werror=maybe-uninitialized]
       *Location = StrAsciiToUnicode (AsciiLocation);

Cc: Abner Chang <abner.chang@amd.com>
Cc: Igor Kulchytskyy <igork@ami.com>
Cc: Nickle Wang <nicklew@nvidia.com>
Signed-off-by: Mike Maslenkin <mike.maslenkin@gmail.com>
---
 .../RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.c        | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.c b/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.c
index 0f0b050d7eba..01c054ae3b70 100644
--- a/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.c
+++ b/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.c
@@ -1856,7 +1856,8 @@ GetEtagAndLocation (
   }
 
   if (Location != NULL) {
-    *Location = NULL;
+    *Location     = NULL;
+    AsciiLocation = NULL;
 
     if (*(Response->StatusCode) == HTTP_STATUS_200_OK) {
       Header = HttpFindHeader (Response->HeaderCount, Response->Headers, HTTP_HEADER_LOCATION);
-- 
2.32.0 (Apple Git-132)



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#112576): https://edk2.groups.io/g/devel/message/112576
Mute This Topic: https://groups.io/mt/103181640/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



  parent reply	other threads:[~2023-12-15  0:04 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-15  0:03 [edk2-devel] [edk2-redfish-client][PATCH 0/4] change method for provisioning + minor fixes Mike Maslenkin
2023-12-15  0:03 ` [edk2-devel] [edk2-redfish-client][PATCH 1/4] RedfishClientPkg: add check for NULL pointer to avoid ASSERT Mike Maslenkin
2023-12-15  1:23   ` Nickle Wang via groups.io
2023-12-15  0:03 ` [edk2-devel] [edk2-redfish-client][PATCH 2/4] RedfishClientPkg: fix typo in EfiRestJsonStructureProtocolIsReady Mike Maslenkin
2023-12-15  1:23   ` Nickle Wang via groups.io
2023-12-15  0:03 ` Mike Maslenkin [this message]
2023-12-15  1:24   ` [edk2-devel] [edk2-redfish-client][PATCH 3/4] RedfishClientPkg: fix access to unitialized variable Nickle Wang via groups.io
2023-12-15  0:04 ` [edk2-devel] [edk2-redfish-client][PATCH 4/4] RedfishClientPkg: use POST method while provisioning new property Mike Maslenkin
2023-12-15  1:53   ` Nickle Wang via groups.io
2023-12-18  0:33     ` Mike Maslenkin
     [not found]     ` <17A1C5C572E0EF8A.24236@groups.io>
2023-12-18  0:57       ` Mike Maslenkin
2023-12-18  5:32         ` Chang, Abner via groups.io

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=20231215000400.5311-4-mike.maslenkin@gmail.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