public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH v1 0/2] Uninitialized local variable.
@ 2022-10-22 16:00 Paul
  2022-10-22 16:00 ` [PATCH v1 1/2] MdeModulePkg: BdsDxe: " Paul
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Paul @ 2022-10-22 16:00 UTC (permalink / raw)
  To: devel; +Cc: Zhiguang Liu, Ray Ni, Gua Guo, Qi Zhang, Rahul Kumar

From: Paul Grimes <paul.grimes@amd.com>

The variable 'VariableSize' is used prior to being
initialized.  This patch initializes the variable.

https://github.com/pbgrimes/edk2/tree/fix_uninitialized_local_variable

Cc: Zhiguang Liu <zhiguang.liu@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Gua Guo <gua.guo@intel.com>
Cc: Qi Zhang <qi1.zhang@intel.com>
Cc: Rahul Kumar <rahul1.kumar@intel.com>


Paul Grimes (2):
  MdeModulePkg: BdsDxe: Uninitialized local variable.
  SecurityPkg: OpalPasswordDxe: uninitialized local variable.

 MdeModulePkg/Universal/BdsDxe/BdsEntry.c       | 2 ++
 SecurityPkg/Tcg/Opal/OpalPassword/OpalDriver.c | 1 +
 2 files changed, 3 insertions(+)

-- 
2.24.0.windows.2


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH v1 1/2] MdeModulePkg: BdsDxe: Uninitialized local variable.
  2022-10-22 16:00 [PATCH v1 0/2] Uninitialized local variable Paul
@ 2022-10-22 16:00 ` Paul
  2022-10-22 16:00 ` [PATCH v1 2/2] SecurityPkg: OpalPasswordDxe: uninitialized " Paul
  2022-10-26  1:17 ` 回复: [edk2-devel] [PATCH v1 0/2] Uninitialized " gaoliming
  2 siblings, 0 replies; 5+ messages in thread
From: Paul @ 2022-10-22 16:00 UTC (permalink / raw)
  To: devel; +Cc: Zhiguang Liu, Ray Ni, Gua Guo

From: Paul Grimes <paul.grimes@amd.com>

In function BdsFormalizeConsoleVariable(), VariableSize is used
prior to being initialized.  This change initializes the variable.

Cc: Zhiguang Liu <zhiguang.liu@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Gua Guo <gua.guo@intel.com>
Signed-off-by: Paul Grimes <paul.grimes@amd.com>
---
 MdeModulePkg/Universal/BdsDxe/BdsEntry.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/MdeModulePkg/Universal/BdsDxe/BdsEntry.c b/MdeModulePkg/Universal/BdsDxe/BdsEntry.c
index 766dde3aaeeb..455fc344f0be 100644
--- a/MdeModulePkg/Universal/BdsDxe/BdsEntry.c
+++ b/MdeModulePkg/Universal/BdsDxe/BdsEntry.c
@@ -518,6 +518,8 @@ BdsFormalizeConsoleVariable (
   UINTN                     VariableSize;
   EFI_STATUS                Status;
 
+  VariableSize = 0;
+
   GetEfiGlobalVariable2 (VariableName, (VOID **)&DevicePath, &VariableSize);
   if ((DevicePath != NULL) && !IsDevicePathValid (DevicePath, VariableSize)) {
     Status = gRT->SetVariable (
-- 
2.24.0.windows.2


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH v1 2/2] SecurityPkg: OpalPasswordDxe: uninitialized local variable.
  2022-10-22 16:00 [PATCH v1 0/2] Uninitialized local variable Paul
  2022-10-22 16:00 ` [PATCH v1 1/2] MdeModulePkg: BdsDxe: " Paul
@ 2022-10-22 16:00 ` Paul
  2022-10-26 13:45   ` [edk2-devel] " Yao, Jiewen
  2022-10-26  1:17 ` 回复: [edk2-devel] [PATCH v1 0/2] Uninitialized " gaoliming
  2 siblings, 1 reply; 5+ messages in thread
From: Paul @ 2022-10-22 16:00 UTC (permalink / raw)
  To: devel; +Cc: Qi Zhang, Rahul Kumar

From: Paul Grimes <paul.grimes@amd.com>

In ProcessOpalRequest(), VariableSize is used prior to being
initialized.  This change initializes the variable.

Cc: Qi Zhang <qi1.zhang@intel.com>
Cc: Rahul Kumar <rahul1.kumar@intel.com>
Signed-off-by: Paul Grimes <paul.grimes@amd.com>
---
 SecurityPkg/Tcg/Opal/OpalPassword/OpalDriver.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/SecurityPkg/Tcg/Opal/OpalPassword/OpalDriver.c b/SecurityPkg/Tcg/Opal/OpalPassword/OpalDriver.c
index f127757ad9f0..d827cea23868 100644
--- a/SecurityPkg/Tcg/Opal/OpalPassword/OpalDriver.c
+++ b/SecurityPkg/Tcg/Opal/OpalPassword/OpalDriver.c
@@ -2184,6 +2184,7 @@ ProcessOpalRequest (
 
   DEBUG ((DEBUG_INFO, "%a() - enter\n", __FUNCTION__));
 
+  VariableSize = 0;
   if (mOpalRequestVariable == NULL) {
     Status = GetVariable2 (
                OPAL_REQUEST_VARIABLE_NAME,
-- 
2.24.0.windows.2


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* 回复: [edk2-devel] [PATCH v1 0/2] Uninitialized local variable.
  2022-10-22 16:00 [PATCH v1 0/2] Uninitialized local variable Paul
  2022-10-22 16:00 ` [PATCH v1 1/2] MdeModulePkg: BdsDxe: " Paul
  2022-10-22 16:00 ` [PATCH v1 2/2] SecurityPkg: OpalPasswordDxe: uninitialized " Paul
@ 2022-10-26  1:17 ` gaoliming
  2 siblings, 0 replies; 5+ messages in thread
From: gaoliming @ 2022-10-26  1:17 UTC (permalink / raw)
  To: devel, paul.grimes
  Cc: 'Zhiguang Liu', 'Ray Ni', 'Gua Guo',
	'Qi Zhang', 'Rahul Kumar'

Paul:
  How do you find this issue? Are they reported by the compiler or code
analyzer? 

Thanks
Liming
> -----邮件原件-----
> 发件人: devel@edk2.groups.io <devel@edk2.groups.io> 代表 Paul via
> groups.io
> 发送时间: 2022年10月23日 0:00
> 收件人: devel@edk2.groups.io
> 抄送: Zhiguang Liu <zhiguang.liu@intel.com>; Ray Ni <ray.ni@intel.com>;
Gua
> Guo <gua.guo@intel.com>; Qi Zhang <qi1.zhang@intel.com>; Rahul Kumar
> <rahul1.kumar@intel.com>
> 主题: [edk2-devel] [PATCH v1 0/2] Uninitialized local variable.
> 
> From: Paul Grimes <paul.grimes@amd.com>
> 
> The variable 'VariableSize' is used prior to being
> initialized.  This patch initializes the variable.
> 
> https://github.com/pbgrimes/edk2/tree/fix_uninitialized_local_variable
> 
> Cc: Zhiguang Liu <zhiguang.liu@intel.com>
> Cc: Ray Ni <ray.ni@intel.com>
> Cc: Gua Guo <gua.guo@intel.com>
> Cc: Qi Zhang <qi1.zhang@intel.com>
> Cc: Rahul Kumar <rahul1.kumar@intel.com>
> 
> 
> Paul Grimes (2):
>   MdeModulePkg: BdsDxe: Uninitialized local variable.
>   SecurityPkg: OpalPasswordDxe: uninitialized local variable.
> 
>  MdeModulePkg/Universal/BdsDxe/BdsEntry.c       | 2 ++
>  SecurityPkg/Tcg/Opal/OpalPassword/OpalDriver.c | 1 +
>  2 files changed, 3 insertions(+)
> 
> --
> 2.24.0.windows.2
> 
> 
> 
> 
> 




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [edk2-devel] [PATCH v1 2/2] SecurityPkg: OpalPasswordDxe: uninitialized local variable.
  2022-10-22 16:00 ` [PATCH v1 2/2] SecurityPkg: OpalPasswordDxe: uninitialized " Paul
@ 2022-10-26 13:45   ` Yao, Jiewen
  0 siblings, 0 replies; 5+ messages in thread
From: Yao, Jiewen @ 2022-10-26 13:45 UTC (permalink / raw)
  To: devel@edk2.groups.io, paul.grimes@amd.com; +Cc: Zhang, Qi1, Kumar, Rahul R

Reviewed-by: Jiewen Yao <Jiewen.yao@intel.com>

> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Paul via
> groups.io
> Sent: Sunday, October 23, 2022 12:00 AM
> To: devel@edk2.groups.io
> Cc: Zhang, Qi1 <qi1.zhang@intel.com>; Kumar, Rahul R
> <rahul.r.kumar@intel.com>
> Subject: [edk2-devel] [PATCH v1 2/2] SecurityPkg: OpalPasswordDxe:
> uninitialized local variable.
> 
> From: Paul Grimes <paul.grimes@amd.com>
> 
> In ProcessOpalRequest(), VariableSize is used prior to being
> initialized.  This change initializes the variable.
> 
> Cc: Qi Zhang <qi1.zhang@intel.com>
> Cc: Rahul Kumar <rahul1.kumar@intel.com>
> Signed-off-by: Paul Grimes <paul.grimes@amd.com>
> ---
>  SecurityPkg/Tcg/Opal/OpalPassword/OpalDriver.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/SecurityPkg/Tcg/Opal/OpalPassword/OpalDriver.c
> b/SecurityPkg/Tcg/Opal/OpalPassword/OpalDriver.c
> index f127757ad9f0..d827cea23868 100644
> --- a/SecurityPkg/Tcg/Opal/OpalPassword/OpalDriver.c
> +++ b/SecurityPkg/Tcg/Opal/OpalPassword/OpalDriver.c
> @@ -2184,6 +2184,7 @@ ProcessOpalRequest (
> 
>    DEBUG ((DEBUG_INFO, "%a() - enter\n", __FUNCTION__));
> 
> +  VariableSize = 0;
>    if (mOpalRequestVariable == NULL) {
>      Status = GetVariable2 (
>                 OPAL_REQUEST_VARIABLE_NAME,
> --
> 2.24.0.windows.2
> 
> 
> 
> 
> 


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-10-26 13:46 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-10-22 16:00 [PATCH v1 0/2] Uninitialized local variable Paul
2022-10-22 16:00 ` [PATCH v1 1/2] MdeModulePkg: BdsDxe: " Paul
2022-10-22 16:00 ` [PATCH v1 2/2] SecurityPkg: OpalPasswordDxe: uninitialized " Paul
2022-10-26 13:45   ` [edk2-devel] " Yao, Jiewen
2022-10-26  1:17 ` 回复: [edk2-devel] [PATCH v1 0/2] Uninitialized " gaoliming

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox